I am trying to install packages into a virtual environment on Ubuntu 20.04. I have sudo access but have read it is bad practice to pip install
with sudo, so I am trying to install into the venv.
I have activated the venv: (flask-prod-venv) iamurray@sjc45d1cetap001:/var/www/flask-prod$
, but when I run pip3 install flask
, I get the following:
Collecting flask
Using cached Flask-2.1.2-py3-none-any.whl (95 kB)
Collecting importlib-metadata>=3.6.0
Using cached importlib_metadata-4.11.4-py3-none-any.whl (18 kB)
Collecting click>=8.0
Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting Jinja2>=3.0
Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting Werkzeug>=2.0
Using cached Werkzeug-2.1.2-py3-none-any.whl (224 kB)
Collecting itsdangerous>=2.0
Using cached itsdangerous-2.1.2-py3-none-any.whl (15 kB)
Collecting zipp>=0.5
Using cached zipp-3.8.0-py3-none-any.whl (5.4 kB)
Collecting MarkupSafe>=2.0
Using cached MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Installing collected packages: zipp, Werkzeug, MarkupSafe, itsdangerous, click, Jinja2, importlib-metadata, flask
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/var/www/flask-prod/flask-prod-venv/lib/python3.8/site-packages/zipp.py'
Check the permissions.
Then I go to check the permissions of this zipp.py
file that appears to be the issue, but I can't find it:
(flask-prod-venv) iamurray@sjc45d1cetap001:/var/www/flask-prod/flask-prod-venv/lib/python3.8/site-packages$ ls -a
. _distutils_hack Flask pip-22.1.2.dist-info pkg_resources setuptools-62.3.4.dist-info _virtualenv.pth wheel wheel-0.37.1.virtualenv
.. distutils-precedence.pth pip pip-22.1.2.virtualenv setuptools setuptools-62.3.4.virtualenv _virtualenv.py wheel-0.37.1.dist-info
Trying to just change permissions produces an error (that makes sense based on the absence of zipp.py in the above output)
(flask-prod-venv) iamurray@sjc45d1cetap001:/var/www/flask-prod/flask-prod-venv/lib/python3.8/site-packages$ chmod 777 zipp.py
chmod: cannot access 'zipp.py': No such file or directory
Could someone please help me install packages into this virtual environment? I am trying to set up an apache server with WSGI. Thank you!