I've create my own package using setup.py, and uploaded, for testing, on test.pypi.og. I've 3 versions : 1.0.0, 1.0.1, 1.1.0. When I want to install it in a new folder/project, there's this error :
ERROR: Cannot install my_package==1.0.0, my_package==1.0.1 and my_package==1.1.0 because these package versions have conflicting dependencies.
The conflict is caused by:
my_package 1.1.0 depends on pysqlite3
my_package 1.0.1 depends on flake8
my_package 1.0.0 depends on flake8
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
But, if I run the command severals times, the name of the packages (depends on ...) change !!??
Part of my setup.py :
python_requires=">=3.8, <4",
packages=find_packages(
include=["sqlalchemy_module"]
),
install_requires=[
"requests",
"pysqlite3",
"SQLAlchemy",
"logging",
"argparse",
"configparser", ],
setup_requires=['setuptools'],
# pip install -e flake8 ... ...
extras_require={
"dev": ['flake8', 'black', 'isort', 'tox', 'mccabe', 'pre-commit', 'bumpver']
},
tests_require=["pytest", "pytest-cov"],
package_data={},
package_dir={"": "."},
Thanks F.
I found the solution to this problem in the following book: Research Software Engineering with Python
Basically, when trying to install a package on testpypi that contains dependencies that are not available on testpypi, we need to add --extra-index-url
to our pip command.
As an example, I tried to pip install a package from testpypi with the following command:
$ pip install -i https://test.pypi.org/simple/ spike2py-preprocess==0.0.2
I got the following error:
ERROR: Cannot install spike2py-preprocess because these package versions have conflicting dependencies.
The conflict is caused by:
spike2py 0.1.15 depends on matplotlib
spike2py 0.1.14 depends on numpy>=1.19.1
spike2py 0.1.13 depends on matplotlib
spike2py 0.1.12 depends on numpy>=1.19.1
spike2py 0.1.11 depends on numpy==1.19.1
spike2py 0.1.10 depends on numpy==1.19.1
spike2py 0.1.9 depends on matplotlib>=3.3.1
spike2py 0.1.7 depends on matplotlib>=3.3.1
spike2py 0.1.6 depends on matplotlib>=3.3.1
spike2py 0.1.5 depends on matplotlib>=3.3.1
spike2py 0.1.4 depends on matplotlib>=3.3.1
spike2py 0.1.3 depends on matplotlib>=3.3.1
spike2py 0.1.2 depends on matplotlib>=3.3.1
spike2py 0.1.1 depends on matplotlib>=3.3.1
spike2py 0.1.0 depends on matplotlib>=3.3.1
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
However, when I reran the command as follows:
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple spike2py-preprocess==0.0.2
My package installed as expected.