Why is Anaconda source activate non-existent?

2020-07-03 07:25发布

I successfully created two separate Python environments in Anaconda, yet seem to be unable to activate either one of them. I have tried to read up on this topic as much as possible here on Stackoverflow, yet no solution did resolve my issue. I added information asked for by comments in this question (Anaconda Environment Doesnt activate).

When trying to activate an environment, the console output is -bash: activate: No such file or directory.

The output of which conda is /Users/username/anaconda3/bin/conda. The output of type source is source is a shell builtin. When trying which activate, the shell returns nothing.

In my bin folder, I also seem not to have an activate executable, but only one which is called activate-global-python-argcomplete.

Why do I lack the standard activate file and how I could resolve this issue best?

8条回答
劫难
2楼-- · 2020-07-03 08:00

Do not do this!!!, this broke my dnf

First I tried to point source to a activate file,

source /usr/lib64/python3.6/venv/scripts/common/activate environment

That appeared to work, but no actual values got updated. I tried the answer by mattexx, but it complained conda wasn't installed, so I used.

conda install conda

I had to have root permission since it was being installed to the root environment, but after that everything appears to work.

That is what broke my fedora installation

查看更多
闹够了就滚
3楼-- · 2020-07-03 08:04

I'm using the bash shell inside pycharm and fixed the problem by making this change:

[~/opt/pycharm-community/plugins/terminal]$ diff jediterm-bash.in.old jediterm-bash.in
65c65
<   source "$JEDITERM_SOURCE"
---
>   eval source "$JEDITERM_SOURCE"

Essentially making the same change recommended above by https://stackoverflow.com/users/1564931/netchkin, but to ~/opt/pycharm-community/plugins/terminal/jediterm-bash.in.

This fixed my existing projects. But any new projects don't seem to try and activate the conda environment at all. It seems as if new projects created in Pycharm 2017.1.2 don't set the JEDITERM_SOURCE variable when starting a session in the terminal plugin.

There is an open issue on this at https://youtrack.jetbrains.com/issue/PY-23417

Looks like there was a big change to the conda activate script in version 4.4.0. See https://conda.io/docs/release-notes.html. If I downgrade conda to 4.3.34 then I can get conda virtual environments to work in the pycharm terminal again.

查看更多
登录 后发表回答