I would like to install some python dependencies using virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
While running this code:
pip install decorator
I receive this error:
bash: /home/pol/Softwares/python/venv/bin/pip:
/home/pol/Softwares/python/venv/bin/python2: bad interpreter:
Too many levels of symbolic links
How can the error solved please and where is the root of the conflict in your view? Thanks
Related
I just switched from using venv to pipenv.
But after I installed pipven through pip:
python -m pip install pipenv
I moved to my new project directory and done creating the virtual environment via:
pipenv shell
Then receive the following error message:
...
ValueError: Not a valid python path: 'C:/Users/%USERPROFILE%/AppData/Local/Programs/Python2/Python27/Scripts/python.exe'
I have check the "Environment Variables" and I set it right. How can I solve this Problems? Many Thanks!!
I have fixed the problem, by using older version of pipenv:
pip install pipenv==2018.10.13
I don't know why this happen but it work with me
I am trying to use venv for my project and it doesn't work correctly.
So first of all I am activating my venv and than use command "pip freeze" to check if there are no modules installed from my computer. And there is an output^
user#DESKTOP-JMJSO6O C:\Users\user\Desktop\app\Scripts
$ activate
(app) user#DESKTOP-JMJSO6O C:\Users\user\Desktop\app\Scripts
$ pip freeze
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
accessify==0.3.1
appdirs==1.4.3
attrs==19.3.0
backcall==0.1.0
beautifulsoup4==4.8.2
bleach==3.1.0
bs4==0.0.1
...
And that is incorrect because I have no modules installed in this venv. What could be the problem?
UPD:
Trying pip --version with venv:
(app) user#DESKTOP-JMJSO6O C:\Users\user\Desktop\app\Scripts $ pip --version
WARNING: pip is being invoked by an old script wrapper. This will fail in a future
version of pip. Please see github.com/pypa/pip/issues/5599 for advice on fixing the
underlying issue. To avoid this problem you can invoke Python with '-m pip' instead
of running pip directly. pip 20.0.2 from
C:\Users\user\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pip (python 3.8)
Also I have founded another problem. For example, I have two python files in one directory:
- app/
- main.py
- conf.py
And when I am trying to import conf as module in main.py, I got the error:
ModuleNotFoundError: No module named 'conf'
Maybe the problem is with Windows? Becuase on the laptop with Windows I don't have any problems like that.
It seems that this problem is caused by two versions of pip, or a fail update attempt.
I suggest that you try following these instructions.
Alternatively try running where pip and pip --version inside and out side the virtual-env and look for differences.
I hope you'll figure this out, the github thread suggests the problem still doesn't have an obvious solution.
When I tried creating a virtual environment with python using the command virtualenv venv from Terminal, I got the following error:
Using base prefix '/Users/zacharythomas/anaconda3'
New python executable in /Users/zacharythomas/venv/bin/python
dyld: Library not loaded: #rpath/libpython3.6m.dylib
Referenced from: /Users/zacharythomas/venv/bin/python
Reason: image not found
ERROR: The executable /Users/zacharythomas/venv/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Users/zacharythomas' (should be '/Users/zacharythomas/venv')
ERROR: virtualenv is not compatible with this system or executable
I'm not the first person to encounter a similar error -- I tried following this answer's recommendations and running:
gfind ~/.virtualenvs/my-virtual-env/ -type l -xtype l -delete
That didn't help. Nor did running sudo virtualenv venv to run commmand as a super user.
What should I investigate next?
I had the exact same error message. Ray Donnelly at Continuum Analytics Support Group provided the following solution, which resolved the issue for me:
When you pip installed virtualenvwrapper, pip will have installed
virtualenv for you as it is a dependency. Unfortunately, that
virtualenv is not compatible with Anaconda Python. Fortunately, the
Anaconda Distribution has a virtualenv that is compatible. To fix
this:
pip uninstall virtualenv
conda install virtualenv
can't get virtualenv to work with anaconda3 v4.3 on mac
My setup has:
- oracle-instantclient (downgraded from 12 to 11)
- Virtual Environment with Python + Django + cx_Oracle
When I downgraded the oracle-instantclient, I tried to reinstall cx_oracle using:
pip install --upgrade --force-reinstall cx_Oracle
The problem is that cx_Oracle keeps complaining that I'm not using the previous installed version 12:
$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: libclntsh.so.12.1: cannot open shared object file: No such file or directory
So, some questions here: "--force-reinstall" is not supposed to make a full reinstall, including a module recompile (aka cx_Oracle)? Somebody has some suggestion about how to workaround this issue? I looked at the pip manual and just tells me that it reinstalls the package. Not very useful.
Update1:
I tried to follow the solution here, adding my cx_Oracle path to the LD_LIBRARY_PATH but it's still not working.
echo $LD_LIBRARY_PATH
/usr/lib/oracle/11.2/client64/lib:/home/myuser/myuserenv/lib/python3.5/site-packages/cx_Oracle-5.2.1.dist-info
Note that my root user has a different python while my virtualenv uses its own python installation.
[root#myserver]# which python
/usr/bin/python
From my virtual environment:
(myvirtualenv) [myuser#myserver]$ which python
~/myvirtualenv/bin/python
Is there some way of installing cx_Oracle manually using my root user but putting the files at the virtual environment somehow?
Update2:
I tried to download cx_Oracle and compile manually using the following command:
sudo -u myuser ~/myvirtualenv/bin/python setup.py build install
But now I'm seeing some permission errors:
(...)
error: could not create 'build/bdist.linux-x86_64/egg': Permission denied
Am I doing the right thing? I don't want to mess this environment. Thanks.
The answer to your question (although you seem to have had another problem) is as follows:
It depends on the module's structure. If its setup script calls the compiler, then yes it does. Because, you see, pip modules by default do not include compiled parts, it's up to the module author to provide them.
I could finally install. The problem is that I had to use the python of my virtualenv. A simple solution but that I completely missed.
Steps:
pip download cx_Oracle
tar -xvf cx_Oracle-5.2.1.tar.gz
~/myenv/bin/python setup.py -v build
sudo ~/myenv/bin/python setup.py install
Note that I had to use sudo in the last step. Without this I was having this permission error:
error: could not create 'build/bdist.linux-x86_64/egg': Permission denied
I have been trying to install Python 2.7 XGBoost on my mac. I am running a framework build of python via brew and trying to install into a virtualenv. I have tried the following methods:
Manual build found here: https://github.com/dmlc/xgboost/blob/master/doc/build.md#python-package-installation
This results in this error:
error: Error: setup script specifies an absolute path:
/Users/username/git/xgboost/python-package/xgboost/../../lib/libxgboost.so
setup() arguments must *always* be /-separated paths relative to the
setup.py directory, *never* absolute paths.
I was able to build xgboost, but I cant install the package. The docs discuss needing disutils, but I can't find it anywhere. I tried running on disutils2, but that didn't work.
pip install found here: https://pypi.python.org/pypi/xgboost/
This results in this error:
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/jj/7r79983d7jvcz_1y6w2n5v2m0000gn/T/pip-build-l4ak5P/xgboost/
Removing "include_package_data=True" from setup.py helps.
See: https://github.com/django-salesforce/django-salesforce/issues/19
In python-package folder,
modify include_package_data=False in setup.py, and python setup.py install;
run: sudo cp ./xgboost/VERSION you_python_lib_location/site-packages/you_xgboost_version.egg/xgboost/
In my computer, you_python_lib_location is /Users/LeonTao/anaconda2/lib/python2.7 and you_xgboost_version.egg is xgboost-0.6-py2.7.egg. So I run:
sudo cp ./xgboost/VERSION /Users/LeonTao/anaconda2/lib/python2.7/site-packages/xgboost-0.6-py2.7.egg/xgboost/