Permission Denied: pipenv - python-3.x

I was trying to install pipenv and creating virtual environment on my linux machine. but pipenv seems to doesn't work. First It said command not found then I updated PATH and now it says permission denied.
Here are some info related to python , pip and pipenv
>>> python3 --version
Python 3.10.5
>>> pip install pipenv
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pipenv in ./.local/lib/python3.10/site-packages (2022.7.24)
Requirement already satisfied: pip>=22.0.4 in /usr/lib/python3.10/site-packages (from pipenv) (22.2)
Requirement already satisfied: certifi in /usr/lib/python3.10/site-packages (from pipenv) (2022.6.15)
Requirement already satisfied: setuptools>=36.2.1 in /usr/lib/python3.10/site-packages (from pipenv) (61.3.1)
Requirement already satisfied: virtualenv-clone>=0.2.5 in ./.local/lib/python3.10/site-packages (from pipenv) (0.5.7)
Requirement already satisfied: virtualenv in ./.local/lib/python3.10/site-packages (from pipenv) (20.16.2)
Requirement already satisfied: distlib<1,>=0.3.1 in /usr/lib/python3.10/site-packages (from virtualenv->pipenv) (0.3.5)
Requirement already satisfied: filelock<4,>=3.2 in ./.local/lib/python3.10/site-packages (from virtualenv->pipenv) (3.7.1)
Requirement already satisfied: platformdirs<3,>=2 in /usr/lib/python3.10/site-packages (from virtualenv->pipenv) (2.5.1)
>>> pipenv --venv
zsh: permission denied: pipenv
>>> sudo pipenv --venv
sudo: pipenv: command not found
>>> whereis python3
python3: /usr/bin/python3 /usr/share/man/man1/python3.1.gz
>>> which python
/usr/bin/python
Here is my PATH variable defined in .zshrc
export PATH="$HOME/.local/lib/python3.10/site-packages:$PATH"
Here is the screenshot of all available Python interpreter in my system
python interpreter list

Related

Anaconda installation

I've installed anaconda on ubuntu, and after that I am unable to install packages it has with pip for every other project in which I use pyCharm. cmd says that when I want to import one of its packages:
Requirement already satisfied: pandas in /home/michal/anaconda3/lib/python3.7/site-packages (0.23.4)
Requirement already satisfied: python-dateutil>=2.5.0 in /home/michal/anaconda3/lib/python3.7/site-packages (from pandas) (2.7.3)
Requirement already satisfied: pytz>=2011k in /home/michal/anaconda3/lib/python3.7/site-packages (from pandas) (2018.5)
Requirement already satisfied: numpy>=1.9.0 in /home/michal/anaconda3/lib/python3.7/site-packages (from pandas) (1.15.1)
Requirement already satisfied: six>=1.5 in /home/michal/anaconda3/lib/python3.7/site-packages (from python-dateutil>=2.5.0->pandas) (1.11.0)
I am a new linux user, just started learning. Did I install anaconda wrong or do I have to somehow use pip only within venv for each particular package install?
I've tried to find answer online, I want to be able to use pip for packages again.

Why pip does not install a package?

pip install indicates that the nitime package was successfully installed but it is not. Why is this?
$ pip3 install nitime
Defaulting to user installation because normal site-packages is not writeable
Collecting nitime
Using cached nitime-0.9.tar.gz (6.2 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in ./.local/lib/python3.8/site-packages (from nitime) (1.22.3)
Requirement already satisfied: cython in /usr/lib64/python3.8/site-packages (from nitime) (0.29.14)
Requirement already satisfied: scipy in ./.local/lib/python3.8/site-packages (from nitime) (1.8.0)
Requirement already satisfied: matplotlib in /usr/lib64/python3.8/site-packages (from nitime) (3.2.2)
Requirement already satisfied: networkx in /usr/lib/python3.8/site-packages (from nitime) (2.5)
Requirement already satisfied: nibabel in ./.local/lib/python3.8/site-packages (from nitime) (3.2.2)
Requirement already satisfied: cycler>=0.10 in /usr/lib/python3.8/site-packages (from matplotlib->nitime) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/lib64/python3.8/site-packages (from matplotlib->nitime) (1.3.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/lib/python3.8/site-packages (from matplotlib->nitime) (2.4.7)
Requirement already satisfied: python-dateutil>=2.1 in ./.local/lib/python3.8/site-packages (from matplotlib->nitime) (2.8.2)
Requirement already satisfied: decorator>=4.3.0 in /usr/lib/python3.8/site-packages (from networkx->nitime) (4.4.0)
Requirement already satisfied: packaging>=14.3 in ./.local/lib/python3.8/site-packages (from nibabel->nitime) (21.3)
Requirement already satisfied: setuptools in ./.local/lib/python3.8/site-packages (from nibabel->nitime) (60.6.0)
Requirement already satisfied: six in /usr/lib/python3.8/site-packages (from cycler>=0.10->matplotlib->nitime) (1.14.0)
Using legacy 'setup.py install' for nitime, since package 'wheel' is not installed.
Installing collected packages: nitime
Running setup.py install for nitime ... done
Successfully installed nitime
$ pip3 show nitime
WARNING: Package(s) not found: nitime
$ python3 -c "import nitime"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'nitime'
$ pip3 show pip
Name: pip
Version: 22.0.4
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: distutils-sig#python.org
License: MIT
Location: /home/servoz/.local/lib/python3.8/site-packages
Requires:
Required-by:
$ uname -a
Linux 5.11.22-100.fc32.x86_64 #1 SMP Wed May 19 18:58:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ python3 -V
Python 3.8.10
EDIT:
Ok! I managed to install using dnf install python3-nitime (fedora).
I don't really understand why pip doesn't work with nitime on fedora ...
This may be because of conflicts with other packages, so try doing this in a new environment. Try creating a virtual environment. Install virtualenv using this:
pip install virtualenv
Create a virtual environment named venv using this:
virtualenv venv
To activate the virtual environment, use this:
source ./venv/bin/activate
Try installing nitime now:
pip3 install nitime
Done!
You can deactivate the virtual environment using this:
deactivate

pip in a (mini)conda environment installs packages in the global site-packages directory

As the answer to this question indicates, pip in a conda-env should install a package in the site-packages directory of env's python. In my case, however, pip (launched within the env) is trying to install in the global python site-packages.
Additionally, the installation in the site-packages of my global python is not so very clean either: newly installed packages fall under /Users/massimopinto/Library/Python/3.9/site-packages/Users/massimopinto/Library/Python/3.9/site-packages , that is the directory is nested within itself, so I need to manually move the new package to make it usable.
Would a re-configuration of pip work? Any advice would be much appreciated.
pip in use (21.2.4):
(spekpy) massimopinto#MacBook-Air-2 spekpy_release % which pip
/Users/massimopinto/opt/miniconda3/envs/spekpy/bin/pip
(env's) pip configuration:
(spekpy) massimopinto#MacBook-Air-2 spekpy_release % pip config list
freeze.timeout='10'
global.editor='vim'
global.timeout='60'
home's pip configuration:
(spekpy) massimopinto#MacBook-Air-2 spekpy_release % cat ~/.pip/pip.conf
[global]
timeout = 60
[freeze]
timeout = 10
running on a MacOS Monterey 12.0.1, conda 4.10.3, Python 3.9.7.
Edited
As at a suggestion by #flyingteller, the output of
/Users/massimopinto/opt/miniconda3/envs/spekpy/bin/python -m pip install . >> spekpy-install.log
is
Processing /Users/massimopinto/Progetti Git/spekpy_release
Requirement already satisfied: scipy in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from spekpy==2.0.6) (1.7.1)
Requirement already satisfied: matplotlib in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from spekpy==2.0.6) (3.4.3)
Requirement already satisfied: pyparsing>=2.2.1 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (3.0.4)
Requirement already satisfied: numpy>=1.16 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (1.21.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (1.3.1)
Requirement already satisfied: python-dateutil>=2.7 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (2.8.2)
Requirement already satisfied: cycler>=0.10 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (0.11.0)
Requirement already satisfied: pillow>=6.2.0 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (8.4.0)
Requirement already satisfied: six>=1.5 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib->spekpy==2.0.6) (1.16.0)
Building wheels for collected packages: spekpy
Building wheel for spekpy (setup.py): started
Building wheel for spekpy (setup.py): finished with status 'done'
Created wheel for spekpy: filename=spekpy-2.0.6-py3-none-any.whl size=66391250 sha256=86962e10ec6182d7f0522dcf0d3e1d264b9d16d3659d5d5af038631d99bd8039
Stored in directory: /private/var/folders/qs/hcv45zhn46q0p6xwndbc51fw0000gn/T/pip-ephem-wheel-cache-etx845ts/wheels/c3/93/d0/2db997ad51d9b10f0b0acac3a1f27240cca3d41a8cac3265ab
Successfully built spekpy
Installing collected packages: spekpy
Successfully installed spekpy-2.0.6
but the installation is still in
/Users/massimopinto/Library/Python/3.9/site-packages/Users/massimopinto/Library/Python/3.9/site-packages/spekpy

Why rasa init is not getting executed?

I have installed rasa using the below commands on my Windows 10.
d:\Learning\vs_rasa_4_beg_udemy>python -m venv ./venv
d:\Learning\vs_rasa_4_beg_udemy>.\venv\Scripts\activate
(venv) d:\Learning\vs_rasa_4_beg_udemy>pip3 install -U --user pip
(venv) d:\Learning\vs_rasa_4_beg_udemy>python -m pip install --upgrade pip
(venv) d:\Learning\vs_rasa_4_beg_udemy>pip3 install rasa
After the above, I have run
(venv) d:\Learning\vs_rasa_4_beg_udemy>rasa init
for which I am getting the message:
'rasa' is not recognized as an internal or external command, operable
program or batch file.
I tried to rerun the pip3 install rasa, which shows that all requirements are satisfied. Why is that rasa init is not getting executed? What shall be done? Appreciate inputs.
(venv) d:\Learning\vs_rasa_4_beg_udemy>pip3 install rasa
Requirement already satisfied: rasa in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (0.0.5)
Requirement already satisfied: requests in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (from rasa) (2.26.0)
Requirement already satisfied: charset-normalizer~=2.0.0 in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (from requests->rasa) (2.0.6)
Requirement already satisfied: certifi>=2017.4.17 in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (from requests->rasa) (2021.5.30)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (from requests->rasa) (1.26.7)
Requirement already satisfied: idna<4,>=2.5 in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (from requests->rasa) (3.2)
Please check if the Python version you're using matches the rasa requirements (currently only Python 3.6, 3.7 and 3.8 are supported)

pip3 install inside venv is throwing "Requirement already satisfied"

I'm trying to get to grips with working inside a virtual environment, I ran the following:
python3 -m venv env
source env/bin/activate
pip3 install flask
And it throws this error:
Requirement already satisfied: flask in /usr/local/lib/python3.7/site-packages (1.1.1)
Requirement already satisfied: Werkzeug>=0.15 in /usr/local/lib/python3.7/site-packages (from flask) (1.0.1)
Requirement already satisfied: Jinja2>=2.10.1 in /usr/local/lib/python3.7/site-packages (from flask) (2.11.1)
Requirement already satisfied: click>=5.1 in /usr/local/lib/python3.7/site-packages (from flask) (7.1.1)
Requirement already satisfied: itsdangerous>=0.24 in /usr/local/lib/python3.7/site-packages (from flask) (1.1.0)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/site-packages (from Jinja2>=2.10.1->flask) (1.1.1)
I'm on OSX and I actually have Python 3.8 installed. I'm a bit lost on this.
I remember way back, around a year ago when I was first installing Python 3.x I had quite a bit of trouble and I feel I might have messed something up during the install or something.
Requirement satisfied means all its dependencies are installed already.

Resources