Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cython dependency not installed before executing setup.py when installing with PyPI #463

Open
stefan-baumann opened this issue Dec 5, 2020 · 9 comments
Milestone

Comments

@stefan-baumann
Copy link

stefan-baumann commented Dec 5, 2020

Problem

When installing madmom via pip on Python 3 (e.g. pip3 install madmom), Cython is missing from the dependencies (correction: Cython is in the dependencies, but not installed before executing setup.py), causing the package install to fail when it is not installed already.

Steps needed to reproduce the behaviour

Just install madmon via pip with Cython not installed.

@superbock
Copy link
Collaborator

superbock commented Dec 5, 2020

cython is listed as a requirement. This issue seems to be related to how pip checks the dependencies and when it installs them, see pypa/pip#25 for more details. I am not sure if reordering the entries in requirements.txt or setup.py could possibly resolve the issue or not. Do you have a chance to try this?

@stefan-baumann
Copy link
Author

stefan-baumann commented Dec 5, 2020

Okay, admittedly I don't know much about creating pip packages. Looking back more closely at the terminal output I got when installing it, it seems like it's actually included, just not installed before trying to execute the setup.py:

  Downloading madmom-0.16.1.tar.gz (20.0 MB)
     |████████████████████████████████| 20.0 MB 4.2 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u04m6iju/madmom/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u04m6iju/madmom/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-u04m6iju/madmom/pip-egg-info
         cwd: /tmp/pip-install-u04m6iju/madmom/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-u04m6iju/madmom/setup.py", line 12, in <module>
        from Cython.Build import cythonize, build_ext
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Output from when it installed successfully afterwards after installing Cython manually for reference:

  Using cached madmom-0.16.1.tar.gz (20.0 MB)
Requirement already satisfied: cython>=0.25 in /media/.../env-linux/lib/python3.8/site-packages (from madmom) (0.29.21)
Collecting mido>=1.2.8
  Downloading mido-1.2.9-py2.py3-none-any.whl (52 kB)
     |████████████████████████████████| 52 kB 1.6 MB/s 
Requirement already satisfied: numpy>=1.13.4 in /media/.../env-linux/lib/python3.8/site-packages (from madmom) (1.19.4)
Requirement already satisfied: scipy>=0.16 in /media/.../env-linux/lib/python3.8/site-packages (from madmom) (1.5.3)
Building wheels for collected packages: madmom
  Building wheel for madmom (setup.py) ... done
  Created wheel for madmom: filename=madmom-0.16.1-cp38-cp38-linux_x86_64.whl size=21666166 sha256=4ad295ead762aa3ffe3c3dcea15d1a2b7733d4dd9077004645cf8bfe99f3c093
  Stored in directory: /home/stefan/.cache/pip/wheels/a2/fc/0f/2d5569ea771ee70a9bf321a72744b4507eb85ff540d82b54eb
Successfully built madmom
Installing collected packages: mido, madmom
Successfully installed madmom-0.16.1 mido-1.2.9

Apparently the issue is that pip/setuptools does not install all of the dependencies before calling the setup.py.
Looking into this problem, I was able to find a PR from another project that apparently fixed the same problem: automl/auto-sklearn#611. Maybe this same approach could be applied for the setup.py here as well?

@stefan-baumann stefan-baumann changed the title Cython dependency is missing on PyPI Cython dependency not installed before executing setup.py when installing with PyPI Dec 5, 2020
@stefansjs
Copy link

Looks like the pyproject.toml is missing from the .tar.gz on pypi. I guess the solution might be to add it to the manifest file.

jazzband/pip-tools#1296 (comment)

@stefansjs
Copy link

Oh, I see now. It looks like the pyproject.toml was added since the last release. The whole purpose of PEP 517 was to address this situation with build-time requirements. My hope is that it should be fixed with the next release.

@TGabor
Copy link

TGabor commented Feb 11, 2021

Is this already fixed?
Installing from github directly works flawlessly for me:

pip install git+https://github.com/CPJKU/madmom

@stefansjs
Copy link

It's fixed in master by 3b60128, but it hasn't been released on pypi yet.

@tae-jun
Copy link

tae-jun commented Aug 8, 2023

@superbock Hi, thanks for building an awesome package. I've been using madmom in my MIR research happily.

And now I'm building a music structure analysis package and trying to publish it.

The package depends on madmom and due to this build-time dependency issue, it can only be installed as:

pip install numpy cython
pip install allinone

but I hope it can be simply pip install allinone.

Because of the policy of PyPI, I can't publish a package with a direct dependency such as:

madmom @ git+https://github.com/CPJKU/madmom

Could you please publish 0.17? It will be highly appreciated. Thanks!

@itsbrex
Copy link

itsbrex commented Sep 23, 2023

+1 for @tae-jun's request. 😁

Thanks for a great package @superbock! Having some trouble with this in not just allinone, so hopefully a patch is on the way?

@yocontra
Copy link

yocontra commented Apr 1, 2024

Just updating that this is still present as of April 2024. I'm working around it by installing cython and numpy in a separate command prior to running the pip install for madmom, having them all in the same requirements.txt still has the same issue oddly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants