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
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 created a virtual environment using conda create -n venv inside the project folder and activated the venv environment. However, I face the following issues:
The venv environment is getting created under C:\Users\Rajesh\anaconda3\envs folder.
When I install packages while in the venv environment, the packages not getting installed in venv folder. Please advise what is going wrong here
The default path of virtual env is located $USER/anaconda3/env, no matter where you execute the create command, the env created will be put in this path. You could change this default path by editing $HOME/.condarc:
envs_dirs:
- some path you like
pkgs_dirs:
- some path you like
Are you sure you have executed conda activate venv before installing packages?
I have Anaconda installed on a server. I have a conda environment on a NAS. The conda environment is not visible to the Anaconda installation, because it was created with a different installation on a different server.
Is it possible to "create" a conda environment from my Anaconda installation that would actually bypass creation and just point to the existing environment on the NAS? This would be similar to using the --fake method in Django to connect to existing tables when a model is migrated.
You can either add the location of the directory containing the environments to your conda config, which tells conda where to "look" for environments, or you can just activate the environment directly by passing the path.
Assuming your your NAS is mapped to a drive letter (such as Z:) and your conda environment is located at Z:/conda/envs/my_env, then you can add that location to your conda configuration via:
conda config --append envs_dirs Z:/conda/envs
Now when you can activate the environment using:
conda activate my_env
If you have another environment named my_env in a different directory, it will be first in the order.
Alternatively, you can activate the environment directly by passing the path.
conda activate Z:/conda/envs/my_env
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
I have activated the python virtual environment, but anyway when I run pip install *, the dependencies are installed to my local Python path. The same happens when I run the server in my Django project: python manage.py runserver -> the system is not using the virtual environment, but the python from my PC. What is the problem? Why my activated virtual environment does not work?
I am using MacOS. Everything worked until I erased all my data and installed again Python.
Thank you!
If the packages aren't getting installed within your virtual environment, it most likely is the case that you are not using the pip within your virtual environment (or may not have pip within your virtual environment at all, in which case it is defaulting to use the pip installed in /usr/local/bin/). First, check that you have a separate version of pip in your virtual environment located in ./your_virtual_environment_name/bin/pip....If you don't, install from the PyPA download page (https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py). When you go to install a package within your virtual environment, activate the virtual environment first using source ./bin/activate inside your virtual environment, then "cd .." and you'll use the pip installed within the virtual environment by typing: ./your_virtual_environment_name/bin/pip install * ....The installation will be in ./your_virtual_environment_name/lib/python3.6/site-packages/