-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PATH not set by conda activate #9392
Comments
Please provide the info requested by the issue template. The conda version in particular is important. |
@msarahan, added |
Thanks. We'll try to look at this soon. |
I have this issue also, conda 4.8.2. I want to use conda for python, but don't want it to be the default system python. My bashrc block is of the form:
I've found that I can get the expected behaviour by stripping out the
With default
However with the stripped down
|
We ran into this problem at my job. We create static, versioned conda distributions rather than updating in place, so we've had issues with old conda dists to staying around in the path. The way we've worked around it is by removing all previous conda dists from the path (most people probably won't have this issue unless they have multiple condas) and to put Not sure if this is the most effective solution. Maybe conda could provide a config setting like "always_reset_conda_shell" in Thanks! |
Thanks! unset CONDA_SHLVL totally worked for me. I've been suffering from this for a while. |
Seconded - good fix! Solved my somewhat related issues with byobu paths and conda environments. |
Also working for me, thank you @shoemakerdr! |
@msarahan, what do you say? |
I'm seeing this on a default miniconda 4.8.2, adding |
@msarahan, any update? |
I noticed that it works if i install a packet when i create the environment.
|
This has been an issue for me with I confirmed this only happens when you create an environment without specifying any additional packages. Also, adding |
facing same problem in miniconda.
|
@msarahan, it's been a year since I've opened this issue. |
Great finding! Atleast helps to find a workaround to the problem. I was so boggled and wasted days because of this issue! |
Not sure if this is a workaround. Is there a In the 2nd environment |
So, the issue I have been facing was as follows. Even though |
Odd. In my case I always create the environment by specifying the list of packages. I never ever change an environment. Still I have the problem. |
Had the same problem. In my case it came from my .profile (the default one), which prepends the |
I found a fix for the issue by appending the following to
This comes just from the finding form @aanousakis, the issue doesn't happen when installing the |
Having this issue as well with Miniconda on macOS 11.2.3. |
Anyone handling this annoying bug? |
My response above has a workaround to fix this issue: #9392 (comment) |
I don't think we want to keep using a workaround instead of actually fixing this issue. |
+1 – none of the workarounds works for me. We need a fix two years after the issue was initially filed. |
If you are on a mac and only have this issue within the terminal in VS Code, but not otherwise, adding this to the VS Code settings.json fixed it for me.
|
I'm getting this same issue on windows when using VS Code. 2 years later, has anyone looked at this? |
miniconda3 v.4.11.0 |
Have the same problem using |
@Atcold I was able to use your |
I was seeing this with a I suspect the more general work-around is: move the |
I believe you are in the right track! Order is very important. I suggest you put every |
I have the same issue and we're speaking the year 2022 of the lord. This bug is open for 3 years now. |
Two ideas:
|
TL;DRConda respects your This is not a bug but expected behavior. Because of this, moving the conda initialization block to the bottom of your shell profile is the recommended solution (kudos to @Tu-Zhenzhao and @kcarnold for figuring this out). DiscussionSeveral other issues are being raised, which made this more confusing than necessary. I will attempt to answer all of the unique issues. If you continue to encounter problems, please open a new issue.
|
Sorry guys, |
Now in 2024, with fresh installation of miniconda on Mac OS via iTerm2, still suffers from this issue. Even I disabled auto-activate base on start, manually However, This is what happened:
|
conda activate
does not prepend the correct virtual environment to$PATH
on Mac and Linux, therefore the system python takes precedence over the virtual environment one.How to observe the bug
Workaround: run
conda deactivate
.Seems like
(base)
needs to be deactivated first.Running
conda config --set auto_activate_base false
addsauto_activate_base: false
to~/.condarc
, but the issue remains.What is going on
The following line should be sufficient to identify the cause of this bug.
Namely, system python shadows the virtual environment one because
conda activate
does not prepend the virtual environment path to$PATH
, but it inserts it in the middle.If
conda deactivate
is called, then the virtual environment path is correctly prepended to$PATH
, which leads to the correct and expected behaviour, which has the virtual environment shadowing the system python.Hack to fix this bug
Adding
conda deactivate
to the end of~/.profile
or~/.bashrc
will haveconda activate
work as expected.Additional bug
The code added to
~/.profile
is buggy (as can be seen here). More precisely there are extra backslashes in\eval
and\export
.Conda info
This bug has been verified on a Mac (Catalina) and on a Linux (CentOS 7).
The text was updated successfully, but these errors were encountered: