sire icon indicating copy to clipboard operation
sire copied to clipboard

Fix InvalidMatchSpec error when installing packages using setup.py

Open CHENFENG1020 opened this issue 11 months ago • 2 comments

No published issue related to this.

In setup.py, within the conda_install function, dep = f'"{dependency}"' leads to an conda error when installing a package with requied version, such as gemmi>=0.6.4: InvalidMatchSpec: Invalid spec '"gemmi>=0.6.4"': Invalid version '0.6.4"': invalid character(s) (*conda version: 25.1.1)

To Reproduce: Create a new env and run python setup.py install_requires, or simply: 'conda' 'install' '"gemmi>=0.6.4"' (How setup.py install package).

The setup.py print:Installing packages using: /xxx/bin/conda install "gemmi>=0.6.4", but it actually using:'/xxx/bin/conda' 'install' '"gemmi>=0.6.4"'

  • I confirm that I have merged the latest version of devel into this branch before issuing this pull request (e.g. by running git pull origin devel): [y]
  • I confirm that I have added a changelog entry to the changelog (we will add a link to this PR as part of the review): [y]
  • I confirm that I have permission to release this code under the GPL3 license: [y]

Suggested reviewers:

@chryswoods, @lohedges

Any additional context of information?

Also updated the installation command in the documentation.

CHENFENG1020 avatar Mar 09 '25 16:03 CHENFENG1020

Many thanks. I've resolved this locally but hadn't pushed a fix (mostly because it doesn't affect the Python versions used for the CI).

@chryswoods: I think the fix on your feature branch in slightly different, albeit with the same affect. Are you okay with this, or should I patch in your change instead. (Mostly to avoid conflicts later.)

lohedges avatar Mar 10 '25 08:03 lohedges

I don't have a strong preference. I stripped the quotes when the conda command was created in case I mistakenly put quotes into the requirements files ;-)

chryswoods avatar Mar 18 '25 08:03 chryswoods