[Note] Items to check when an infinite loop occurs in pyenv

background

I tried to install anaconda to install the data analysis library all at once, but when I run pip or python commands while trying to install anaconda with pyenv (a package that can switch between multiple versions of Python), an infinite loop occurs. It has occurred. I looked it up in "pyenv infinite loop" etc. and also referred to posted by a_yasui, but at the beginning of .bash_profile

PATH=$PATH:~/.pyenv/shims/
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi

I added and checked .bashrc, so I guessed something else was wrong.

environment

OS: Mac OSX El Capitan 10.11.3 Execution environment: Mac standard Terminal Confirmed with pyenv: Build 20151210, 20160202

Symptoms and solutions

As a symptom, when I execute the pip command etc., the command loops like bash → readlink → bash, and the execution does not proceed. The solution was to install __Python with the pyenv install command and apply python with pyenv local orz __. First,

>> which python
/Users/user/.pyenv/shims/python
>> which pip
/Users/user/.pyenv/shims/pip

However, when I enter the pyenv version command,

>> pyenv version
system (set by /Users/user/.pyenv/version)

I noticed that "Oh, I didn't put Python in pyenv" because it was displayed only.

// >> pyenv install -You can check the installable version with l
>> pyenv install Python3.5.0 //Python installation
>> pyenv rehash //Refresh pyenv
>> pyenv local Python3.5.0 //Apply python
>> pyenv global Python3.5.0 //Apply python

I typed and changed the python to use and then ran the pip, python commands and it worked. Probably, I imagine that there is a problem if system python is used for python used in the environment of pyenv (/Users/user/.pyenv/).

It may be a symptom that is not reproducible, and I think that it is a general mistake because I used pyenv without understanding it well, but if you happen to have a similar symptom, Python used in pyenv Try to see if is not for system. We hope for your reference.

pyenv local system
pyenv global system
pip

When I typed and executed pip etc., the infinite loop was reproduced. I hope it happens only in my environment ...

appendix

The reason why I noticed that python doesn't work in the first place is that I am using SublimeCodeIntel and looking at the log.

evaluating 'str' at hoge.py#37: no Python scan info for <Python buf 'hoge.py'>
done eval: eval error

Was output. When I wondered if python was wrong and ran python on the terminal, the above symptom was discovered.

Recommended Posts

[Note] Items to check when an infinite loop occurs in pyenv
[OSX] [pyenv] What to do when an SSL error occurs in pip
When I try to upgrade pip, I get an infinite loop after failing to upgrade
[Python] I want to know the variables in the function when an error occurs!
[python] What to do when an error occurs in send_keys of headless chrome
Precautions when adding items using DateField to an existing model later in Django
The first thing to check when a No Reverse Match occurs in Django
Things to note when initializing a list in Python
How to specify an infinite number of tolerances in the numeric argument validation check of argparse
How to check if a value exists in an enum
What to do when an error occurs with import _ssl
[Beanstalk] What to do when an error occurs with import uuid
Measures to be taken when Suspicious Operation occurs in HttpResponse Redirect
What to do when UnicodeDecodeError occurs during read_csv in pandas (pd.read_table ())
What to do when ModuleNotFoundError: No module named'XXX' occurs in Python
[Question] In sk-learn random forest regression, an error occurs when the number of parallels is set to -1.
Points to note when updating to WSL2
An alternative to `pause` in Python
Python Note: When you want to know the attributes of an object
Create an empty array in Numpy to add rows for each loop
A note when looking for an alternative to pandas rolling for moving windows
What to do if an error occurs when importing numpy with VScode