Shima Masaeli
Shima Masaeli

Reputation: 103

cannot create a virtual environment

I've recently changed my OS to windows 10 and setup anaconda 3. The problem is that in Anaconda Navigator (in the Environment tab) when clicking on the create button to make a new virtual environment, after setting a name and the python version (to 3.7 as the only option), the venv won't be created, instead, I get this error:

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win- 
64/current_repodata.json><br>Elapsed: -<br><br>An HTTP error occurred when trying to retrieve this 
URL.<br>HTTP errors are often intermittent, and a simple retry will get you on your way.<br><br>If 
your current network has https://www.anaconda.com blocked, please file<br>a support request with your 
network engineering team.<br><br>'https://repo.anaconda.com/pkgs/main/win-64'<br> 

Although I can open this file in my browser: https://repo.anaconda.com/pkgs/main/win- 64/current_repodata.json

On the other hand, when I try to make a virtual env following these steps:

mkdir projects
cd projects
mkdir drdr
cd drdr
python -m venv ./venv

Then when I activate the venv like below:

venv\Scripts\activate.bat

I get:

(venv) (base) C:\Users\shima\projects\drdr>

which I don't know what is (venv) (base). Should I realize it activated or not. Even when I try to activate my venv by the code below:

conda activate venv

I get this message:

Could not find conda environment: venv

Also, after making the venv, when I want to import it in my navigator no matter I choose which folder inside my venv folder, I can't import it

By the way, checking whether firewall allows traffic from anaconda, I cannot find anaconda in the list of allowed apps and trying to add it the list, I don't know what folder inside anaconda's folder I should add

I don't know why this problem has happened, and couldn't find an answer in anaconda documents or others questions here in StackOverflow, so I really appreciate any help in this issue.

Thanks a lot!!

Upvotes: 1

Views: 3650

Answers (1)

FlyingTeller
FlyingTeller

Reputation: 20472

python -m venv ./venv

you are mixng conda virtual environments with virtualenv virtual environments, hence all the confusion:

(venv) (base) C:\Users\shima\projects\drdr>

does look strange, because it is. You are in the baseenvironment of conda, but have activated a virtualenv environment called venv

Could not find conda environment: venv

there is no conda enviroment venv, you have never created one.

In short:

When using conda, don't use virtualenv, insted use

 conda create -n venv

to create a virtual environment and

conda activate venv

to activate it

Upvotes: 1

Related Questions