I have built a python module which installs kwikapi==0.4.5 and requests==2.22.0. But kwikapi has requests==2.18.4.
Now when I install and run my package, I am getting error pkg_resources.ContextualVersionConflict: (requests 2.22.0 (/tmp/test_vir3.7/lib/python3.7/site-packages), Requirement.parse('requests==2.18.4'), {'kwikapi'})
.
Now if I install requests==2.18.4(pip install requests==2.18.4) and run then the error is pkg_resources.DistributionNotFound: The 'requests==2.22.0' distribution was not found and is required by my-pack
.
I can use 2.18.4 instead of 2.22.0 requests to solve this. But this problem again comes if I have same module with different versions in both requests and in kwikapi.
Is there a way to ignore/solve this error?
setup/reproduce
Module structure
.
├── my_pack
│ └── __init__.py
└── setup.py
setup.py
from setuptools import setup, find_packages
version = "0.0.1"
setup(
name="my_pack",
packages=find_packages("."),
package_dir={"my_pack": "my_pack"},
include_package_data=True,
install_requires=[
"kwikapi==0.4.5",
"requests==2.22.0"
],
entry_points={"console_scripts": ["my_pack = my_pack:main"]},
)
__init__.py
def main():
print("Hey! I ran")
Create python virtual environment and activate
$ python3.7 -m venv vir
$ source vir/bin/activate
install
# Go to setup.py file location and do
$ pip install .
Run
$ my_pack