-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use 'pip install' in the virtual environment created by conda #1429
Comments
Command 'pip install' installs packages globally to ~/Users/user/anaconda/lib/python3.6/site-packages |
This is not true.
Note that SciPy was installed into the "pipenv" conda environment, because that is where pip was run from. If you only happen to have |
@bryevdv When I run the command |
Closing then, as the question is solved now. |
This works only if pip is added when the conda env is created. If I add pip later using |
@kronos29296 huh - any idea why? |
Kronos, when you come back later and do 'conda install pip' as you said, did you specify which environment to install pip into? Perhaps its installing to the global directory as you say because its installing to the root environment. |
The problem occurs when i create an empty conda env first and activate it. Then I conda install pip. In the same activated env, if i use pip install, it installs to global directory. The env is activated and conda install works properly though. This doesn't occur if I add pip to env when creating it. This is the problem. |
@kronos29296 |
@billism That worked for me, but was not necessary if I installed pip when creating the env, i.e. |
@billism So I 👍 to @kronos29296 report of pip's behavior |
I've investigated a bit. The scenario reported by @kronos29296 occurs when you
It can be fixed by deactivating and reactivating the env. An example: conda create -n pipenv
source activate pipenv
pip freeze # shows packages installed to global
conda install pip at this point, the behavior reported occurs
to fix:
|
I also have confusion about the environments. I tried the @ashander 's suggestion but it is not working. So far I am unable to isolate the environments (and install packages only in environment of my choice using pip)? My scenario:
I opened up 3 terminal windows, activated the environments and issued the
I also added the python interpreter from |
Conda 4.4 will resolve this issue. |
Thank you all for a very good question and excellent answers. I learned a lot from this topic! |
Try 'type pip' instead of 'which pip' to check the real current version of your 'pip'. And trying 'hash -r' to clean the cache might help you sometimes. |
Thanks guys, now I understand why I got my global env totally messed up after creating and installing what I thought to be a clean fresh env... https://groups.google.com/a/continuum.io/forum/#!topic/conda/yC5xVTbJfwA It looks like it is not a good idea to mix conda packages with pip ones since it breaks conda's hard links (learned it the hard way). However, is it safe to create a pipenv (like the exemple in this discussion) and then install only pip packages ? should it break any links ? |
Thank you, this thread helped me a lot. |
I've read through this thread and understood the workaround proposed, but I still have an issue. Is someone getting the same issue? |
The easiest work around I have found, on Linux, is NB: This is done after activating the desired conda environment. |
@JoshuaC3 this not a good idea in my opinion. There is no reason to invoke |
@xguse thanks for your explanation. I do this once I have used It has not (so far) affected my root python environment, I guess because of what is described in thammegowda's post above. |
@ashander I tried your advices and the problem got resolved |
Apologies for reviving this thread, but I am experiencing some very unexpected behaviour. I created a Conda environment through Pycharm (when setting up a new project)
This runs as expected and tells me that it installed all the packages. Running pip freeze shows none of the packages. I tried deactivating and reactivating, I tried explicitly calling the environment specific pip, I checked type pip and which pip (both pointing to the environment specific pip) but without success. Any pointers? |
@FBosler with the environment activated, run Maybe something like |
in ~/.bashrc instead of
one would use
so the bash will find system default pip and pip3 first instead of pip within anaconda |
This is a very useful post! |
After conda 4.4 we should add |
A good way to also do this imo is by creating the conda environment and installing a python version in it: |
The thread is helpful. I am using Ubuntu 18.04.2 LTS and Conda==4.5.12. A quick workaround for me was creating alias |
Deactivating and reactivating worked for me :)
|
Until now I was managing my Python envs with conda and
was giving local packages. Then I
(I had not conda install pip beforehand) Now for any conda environment I am activating
And getting still the same after Is there a way I can restore the situation, meaning having pip freeze correctly describe the conda env that is currently active?
|
Ok the reason was that I was using |
There is a lot to read here. What is the simplest way to install packages into a preexisting conda environment using pip when:
Thanks |
|
had a similar problem
. My solution was to do
|
I'm way late to this thread, but I have experienced lots of trouble in the past with getting the Before I proceed, I would like to note that the solution proposed by several people above (installing pip at the time of creation of a new conda environment using After running
After that the NOTE: The I hope that this helps! |
Surprisingly enough, when I activate my envs in tmux panes, |
|
It works. Need to deactivate twice. Here are steps:
|
Thanks @marcglobality @makcedward , that's what I need, just wondering why this is not solved entirely, when I activate an venv, it should automatically set the path to the venv's python and pip |
Hi, guys:
I have some confusion about the scenario where I use 'pip install' in the virtual environment create by conda. If I did so, is the python package installed by 'pip' global or local to this conda virtual environment?
Thank you in advance.
Best,
Cico
The text was updated successfully, but these errors were encountered: