Just came across a very weird behavior of pipenv that I don't quite understand. Here is my environment Running terminal and iTerm2 under Rosetta Python 3.11.9 installed via Pyenv (2.4.8) and set as global pyenv global 3.9.11 Another Python 3.11.9 installed using the package downloaded directly from python's official website I setup a experiment project and it organized as following /dependencyExp_01/ |--app.py |--Pipfile where Pipfile is [[source]] url = "https://pypi.org/simple" verify_ssl = true name = "pypi" [packages] packaging = "*" typing_extensions = "*" [dev-packages] and app.py is from packaging.version import Version print("something") I installed the dependency uisng $ pipenv install Then $ pip list and you can see that packaging is not in the list Package Version ---------- ------- pip 24.3.1 setuptools 75.6.0 wheel 0.45.1 Also, $ pipenv graph, packaging is in the list importlib-metadata==8.0.0 - zipp [required: >=0.5, installed: 3.19.2] jaraco.collections==5.1.0 - jaraco.text [required: Any, installed: 3.12.1] - autocommand [required: Any, installed: 2.2.2] - inflect [required: Any, installed: 7.3.1] - more-itertools [required: >=8.5.0, installed: 10.3.0] - typeguard [required: >=4.0.1, installed: 4.3.0] - typing-extensions [required: >=4.10.0, installed: 4.12.2] - jaraco.context [required: >=4.1, installed: 5.3.0] - backports.tarfile [required: Any, installed: 1.2.0] - jaraco.functools [required: Any, installed: 4.0.1] - more-itertools [required: Any, installed: 10.3.0] - more-itertools [required: Any, installed: 10.3.0] packaging==24.2 tomli==2.0.1 However, when I try to run app.py I got this (dependencyExp_01) jingwang@jing-MacBook-Pro dependencyExp_01 % python app.py Traceback (most recent call last): File "/Users/jingwang/Documents/PythonProject/dependencyExp_01/app.py", line 1, in <module> from packaging.version import Version ModuleNotFoundError: No module named 'packaging' Then I installed packaging using $ pip install packaging After $ pip list I get, packaging appears in the list Package Version ---------- ------- packaging 24.2 pip 24.3.1 setuptools 75.6.0 wheel 0.45.1 Also, $ pipenv graph, the graph is the same as that before the pip install importlib-metadata==8.0.0 - zipp [required: >=0.5, installed: 3.19.2] jaraco.collections==5.1.0 - jaraco.text [required: Any, installed: 3.12.1] - autocommand [required: Any, installed: 2.2.2] - inflect [required: Any, installed: 7.3.1] - more-itertools [required: >=8.5.0, installed: 10.3.0] - typeguard [required: >=4.0.1, installed: 4.3.0] - typing-extensions [required: >=4.10.0, installed: 4.12.2] - jaraco.context [required: >=4.1, installed: 5.3.0] - backports.tarfile [required: Any, installed: 1.2.0] - jaraco.functools [required: Any, installed: 4.0.1] - more-itertools [required: Any, installed: 10.3.0] - more-itertools [required: Any, installed: 10.3.0] packaging==24.2 tomli==2.0.1 Now when I run the app.py again, the error is gone and I can see the text printed out (dependencyExp_01) jingwang@jing-MacBook-Pro dependencyExp_01 % python app.py something (dependencyExp_01) jingwang@jing-MacBook-Pro dependencyExp_01 Currently the workaround is to install those missing packages separately using $ pip install <whatever>, however, it's quite annoying. It would less hassle if pipenv install can take care of it. I don't know why it behaves like that, can anyone help here? Thanks Continue reading...