pythonpippython-packagingrequirements.txt

Wrong dependency installed with pip


I wonder if anyone could please help me with this issue:

I have two python libraries lime and specsy, where the first library is a dependency of the second.

At the time when I added lime to PyPi there was another library with the same name so I declared it as lime-stable.

I have now uploaded specsy to its PyPi but when I try to install it this happens:

a) It installs the third party "lime" library (not mine)

b) It installs an older version of specsy.

I have actually declared it as "lime-stable" in three different places:

a) The project.toml which I think is the expected place:

[project]
name = "specsy"
version = "0.2.2"
readme = "README.rst"
description = "Model fitting package for the chemical analysis of astronomical spectra"
dependencies = ["arviz~=0.18",
                "astropy~=6.0",
                "corner~=2.2",
                "h5netcdf~=1.3.0",
                "jax~=0.4",
                "jaxlib==0.4.26",
                "lime-stable~=1.0",
                "lmfit~=1.3",
                "matplotlib~=3.8",
                "numpy~=1.26",
                "pandas~=2.2.2",
                "pymc~=5.13",
                "PyNeb~=1.1",
                "pytensor~=2.20",
                "scipy~=1.13",
                "six~=1.16.0",
                "toml~=0.10",
                "tomli >= 2.0.0 ; python_version < '3.11'",
                "xarray~=2024.3.0"]

b) The requirements.txt file

arviz~=0.18
astropy~=6.0
corner~=2.2
h5netcdf~=1.3.0
jax~=0.4
jaxlib~=0.4
lime-stable~=1.0
lmfit~=1.3
matplotlib~=3.8
numpy~=1.26
pandas~=2.2.2
pymc~=5.13
PyNeb~=1.1
pytensor~=2.20
scipy~=1.13
six~=1.16.0
toml~=0.10
tomli >= 2.0.0 ; python_version < "3.11"
xarray~=2024.3.0

c) and the setup.py file:

  packages=find_packages('src'),
  package_dir={'': 'src'},
  package_data={'': ['config.toml', 'inference/*', 'innate/*', 'models/*', 'operations/*', 'resources/*', 'workflow/*']},
  include_package_data=True,
  install_requires=["arviz", "astropy", "h5netcdf", "jax", "jaxlib", "lime-stable", "lmfit", "matplotlib", "numpy",
                    "pandas", "pymc", "PyNeb", "pytensor", "scipy", "toml", "xarray"],

But it still installs "lime" instead of "lime-stable" from pip.

I wonder if anyone coculd please point me towards the source of the conflict.


Solution

  • So i tried to pip install specsy. It pulled theright version 0.2.2 as shown in the pip freeze > requirements.txt output

    lime-stable==1.0.0
    lmfit==1.3.1
    logical-unification==0.4.6
    markdown-it-py==3.0.0
    MarkupSafe==2.1.5
    matplotlib==3.8.4
    .
    .
    .
    specsy==0.2.2
    Sphinx==7.3.7
    sphinxcontrib-applehelp==1.0.8
    sphinxcontrib-devhelp==1.0.6
    sphinxcontrib-htmlhelp==2.0.5
    sphinxcontrib-jsmath==1.0.1
    sphinxcontrib-qthelp==1.0.7
    sphinxcontrib-serializinghtml==1.1.10
    stack-data==0.6.3
    tinycss2==1.3.0
    toml==0.10.2
    
    

    So I am not able to recreate the error you are talking about. The versions are also the ones you have in PyPi packages.