The terminal output is shown below. I created a new folder called PrintCheckList then created a pipenv environment where I installed pyyaml. I executed pipenv shell
and then python
. When I try to import yaml
it fails. An ls
of the pipenv site packages reveals it's there. I've used pipenv several times without this problem.
~/Python $ mkdir PrintCheckList
~/Python $ cd PrintCheckList/
~/Python/PrintCheckList $ pipenv --python 3.8 install pyyaml
Creating a virtualenv for this project…
Pipfile: /home/me/Python/PrintCheckList/Pipfile
Using /usr/local/bin/python3.8 (3.8.5) to create virtualenv…
⠦ Creating virtual environment...created virtual environment CPython3.8.5.final.0-64 in 378ms
creator CPython3Posix(dest=/home/me/.local/share/virtualenvs/PrintCheckList-bTBe9zUr, clear=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/me/.local/share/virtualenv)
added seed packages: pip==20.2.2, setuptools==49.6.0, wheel==0.35.1
activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
✔ Successfully created virtual environment!
Virtualenv location: /home/me/.local/share/virtualenvs/PrintCheckList-bTBe9zUr
Creating a Pipfile for this project…
Installing pyyaml…
Adding pyyaml to Pipfile's [packages]…
✔ Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Building requirements...
Resolving dependencies...
✔ Success!
Updated Pipfile.lock (dc1c24)!
Installing dependencies from Pipfile.lock (dc1c24)…
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
~/Python/PrintCheckList $ pipenv shell
Launching subshell in virtual environment…
~/Python/PrintCheckList $ . /home/me/.local/share/virtualenvs/PrintCheckList-bTBe9zUr/bin/activate
(PrintCheckList) ~/Python/PrintCheckList $ pipenv graph
PyYAML==5.3.1
(PrintCheckList) ~/Python/PrintCheckList $ python
Python 3.8.5 (default, Sep 2 2020, 15:36:56)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'yaml'
>>> ^D
(PrintCheckList) ~/Python/PrintCheckList $ ls ~/.local/share/virtualenvs/PrintCheckList-bTBe9zUr/lib/python3.8/site-packages/
_distutils_hack pip-20.2.2.dist-info setuptools _virtualenv.py yaml
distutils-precedence.pth pip-20.2.2.virtualenv setuptools-49.6.0.dist-info wheel
easy_install.py pkg_resources setuptools-49.6.0.virtualenv wheel-0.35.1.dist-info
pip PyYAML-5.3.1.dist-info _virtualenv.pth wheel-0.35.1.virtualenv
(PrintCheckList) ~/Python/PrintCheckList $
I solved the problem by getting rid of these aliases in my .bashrc: