Reputation: 285
I have a python package uploaded to GitHub. This package uses Pipenv to manage dependencies. On the other side, I have a python tool using that library (and using Pipenv to manage its own dependencies).
Looking at my package's Pipfile, we can see that it has two dependencies:
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
requests = "*"
loggly-python-handler = "*"
[dev-packages]
pylint = "*"
[requires]
python_version = "3.7"
In my python tool, I installed my package using:
pipenv install -e git+https://github.com/<name>/<name>.git#egg=<name>
However, when examining the tool's pip graph, it looks like my package has no dependencies:
(tool-aqleTTYE) C:\Projects\tool>pipenv graph
<my_package>==0.0.3
pylint==2.0.1
- astroid [required: >=2.0.1, installed: 2.0.1]
- lazy-object-proxy [required: Any, installed: 1.3.1]
- six [required: Any, installed: 1.11.0]
- wrapt [required: Any, installed: 1.10.11]
- colorama [required: Any, installed: 0.3.9]
- isort [required: >=4.2.5, installed: 4.3.4]
- mccabe [required: Any, installed: 0.6.1]
I expected to see that my package depends on requests
and loggly-python-handler
. And indeed, when running the code it says that it cannot find the package dependencies..
pipenv run python tool.py
....
File "c:\.virtualenvs\tool-aqlettye\src\tool\tool\logger.py", line 35, in <module>
'level': 'DEBUG',
File "c:\python37\Lib\logging\config.py", line 792, in dictConfig
dictConfigClass(config).configure()
File "c:\python37\Lib\logging\config.py", line 563, in configure
'%r' % name) from e
ValueError: Unable to configure handler 'loggly'
And just to be sure:
(tool-aqleTTYE) C:\Projects\tool>python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'requests'
Is it a bug or am I doing something wrong?
Upvotes: 5
Views: 932
Reputation: 117
Try:
pipenv lock --clear
this should clear your lock file. It worked for me.
After just uninstall and install:
pipenv uninstall --all
then
pipenv install
I had the same problem with custom package (.whl) that I first created without dependencies (install_requires) defined in the "setup.py". I uploaded it to a personal pypi repository and installed it. After correcting my error and updating it with the requirements and retry to install it, the dependencies were not working.
I found that lock file doesn't show the dependency changes but "pipenv graph" show them.
Then I found the command here
Upvotes: 1