RF_956
RF_956

Reputation: 341

Can't install python packages/modules inside a virtual environment

I don't know what just happened or what I did. It suddenly just can't install the python packages/modules when I tried to install them.

I am using a macbook pro laptop. I have been using virtual environment, there were no problems until now. I tried these in my terminal while I'm on the virtual environment:

pip install pandas
pip install mezzanine
pip install django

and I always received this message. enter image description here

I tried to uninstall virtualenv, pip, and used pip3, but nothing works. On the other hand, I tried installing those packages/modules without using the virtual environment, and everything went well.

I have two python versions, the python3 and python2.

Does it matter to know which python version is pip using? (I THINK YES?!)

I CREATED A VIRTUAL ENVIRONMENT USING PIP, IT CREATED A VIRTUAL ENVIRONMENT WITH PYTHON 2 VERSION INSTALLED, BUT WHEN ASKED TYPE THIS IN THE TERMINAL:

pip --version

WHAT CAME OUT WAS THAT IT'S ON PYTHON 3.6

pip 10.0.0 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip (python 3.6)

FOR MORE INFO:

ll --> name of virtual environment: python 2 version used

Python2:

/Users/macintosh/Documents/ll/bin/python2

Python 3:

/Library/Frameworks/Python.framework/Versions/3.6/bin/python3

This did not happened before. I can use "pip install [module name]" without any problem like this before. I don't know what happened. So, I can't fix it. My last resort is to format everything in my laptop which is sad. Please help thanks.

Upvotes: 0

Views: 10851

Answers (5)

rithrian
rithrian

Reputation: 11

This line worked for installing in my python virtual environment:

python -m pip install [module name]

Upvotes: 1

Anusha
Anusha

Reputation: 1

I was using windows command prompt, it was showing the same error. Then I tried installing libraries in the virtual environment using anaconda prompt. It was working

Upvotes: 0

pacocampo
pacocampo

Reputation: 66

Maybe too late but in my case I had to create a new virtualenv with:

python -m virtualenv <virtual_env_venv>

then (after activating it) I was able to do a successful installation in the new virtualenv

Upvotes: 2

Roushan
Roushan

Reputation: 4420

from official

if you are working in a Virtual Environment created by virtualenv or pyvenv. Just make sure to upgrade pip.

upgrade pip by

On Linux or macOS:

pip install -U pip

Upvotes: 2

user9546412
user9546412

Reputation: 11

Use a terminal and write this code:

python -m install [module name]

Use this code without keys and replace the module name ,your preference module.

Upvotes: 1

Related Questions