I'm having a lot of trouble setting up a virtual env in atom. I tried installing atom-python-virtualenv and I'm trying to use configure script, but it still says "no virtualenv" at the bottom of the atom editor. How can a select or make a virtualenv for atom?
I'm not sure how to make the environment from Atom itself but you can make your virtual environment from the command line by typing
conda create -n myenv python=3.6
where 3.6 can be changed to whatever version you have installed and myenv is a name for your environment. You then activate the environment by typing
conda activate myenv
Now you can run Atom from this environment. Directions concerning virtual environments are located here and here
Related
I created a python virtual environment using this command:
$ python -m venv panda
It has been created successfully but when I try to activate the environment using:
$ activate panda/Scripts/activate.bat
It gives me the following error:
Not a conda environment: F:\panda\Scripts\activate.bat
I'm using:
conda 4.10.3
Python 3.9.7
Git Bash 2.35.1.windows.2
You may want to take a look at this question: How to source virtualenv activate in a Bash script. It may help with activating environments in bash.
. ./panda/scripts/activate should activate your environment; however, it with be a Python virtual environment and not a Conda environment.
If you are trying to use a Conda virtual environment, this page may help: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
I have activated the conda environment at first and then I have tried to activate the venv created by python3s' native virtualenv package without deactivating the conda environment. To my surprise both the venv are in running state. But python used by the venv is the one which I have activated recently. Can any one explain what is happening here ?
~$ which python3
/usr/bin/python3
~$ conda activate py369
(py369) ~$ which python
/home/xxx/anaconda3/envs/py369/bin/python
(py369) ~$ source venv/bin/activate
(venv) (py369) ~$ which python
/home/xxx/venv/bin/python
(venv) (py369) ~$
If this is like both the venv's are activated then Am I able to access both the packages from conda env and also the venv?
This is what is happening:
You activate the conda environment. conda then modifies your PATH such that /home/xxx/anaconda3/envs/py369/bin is first. You can check this with echo $PATH. It also modifies your shell prompt such that (py369) is displayed in front
You activate your virtualenv environment. Since virtualenv is oblivious of what conda does, it simply modifies your PATH such that /home/xxx/venv/bin/ and puts its own prefix in front of your shell prompt
So now, when you call python, it will be started from the virtualenv folder. When you import packages, they will be loaded from what is installed inside your virtualenv. So you cannot just import from both the conda and virtualenv environment at the same time.
You also have not mentioned why you would want to have such a set up. My personal opinion is that you should not mix different environment programs, as it will only generate confusion.
I am using Visual Studio Code and have Anaconda downloaded so i selected it as my path interpreter.
I am able to download virtualenv using pip install virtualenv and then instantiate it using virtualenv env.
The issue occurs when I try to activate the environment using activate env or conda activate env.
Error message returned: Could not find conda environment: env. I then proceeded to look into my directory and I see that the environment is included as a folder so I'm confused on why I cannot activate it. For reference I am using Windows.
Edit: Originally the environment was not appearing in my users/.conda/environments file but using conda create --name venv I was able to create a new environment here. However, it doesn't instantiate in my current directory. Thoughts?
conda virtual environments are not interchangeable with virtualenv virtual environments. If you have created a virtual environment in your current dir. The ps command would be .\Scripts\activate
I am using miniconda 4.5.1 on 4.13.0-37-generic GNU/Linux
I am also using tmux, if that's useful.
When I activate my environment by running source activate ___
conda fails to set up the paths, meaning my python and pip commands are still mapped to the conda regular (or whatever the name is) python commands, not those from my environment. I get the (env-name) tag before my terminal prompt, as though it has been activated.
I have to activate, then deactivate, then reactivate, to force this to happen, using the following commands:
source activate envname
source deactivate
source activate envname
Any clue as to why this might be happening? Thanks!
I am working with Anaconda and Spyder which works well.
Lately, I have started to work with different environments which I create like this:
$ conda create -n my_env python=3.5
$ source activate my_env
$ conda install pyomo pandas numpy ipython
$ conda info --envs
Using Anaconda Cloud api site https://api.anaconda.org
# conda environments:
#
my_env * /home/user/.anaconda3/envs/my_env
root /home/user/.anaconda3
Per default Spyder seems to run the Python interpreter of Anacondas root environment.
Setting the default interpreter in the Spyder preferences (e.g. to /home/user/.anaconda3/envs/my_env/bin/python does not seem to be the same as activating environments and then running scripts.
So how can I permanently set (activate) interpreters of other Anaconda environments within Spyder?
BTW: I am on Xubuntu 16.04 X64 and .bashrc solutions are no option for me. I would like to solve the problem within Spyder.