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

pip-compile and pip-sync across OS #796

Closed
AbdealiLoKo opened this issue Apr 24, 2019 · 2 comments
Closed

pip-compile and pip-sync across OS #796

AbdealiLoKo opened this issue Apr 24, 2019 · 2 comments

Comments

@AbdealiLoKo
Copy link
Contributor

If I run pip-compile on ipython on a Mac, the requirements.txt contains appnope which is a Mac-only library and hence the pip-sync fails on linux when doing source installs.

I use a Mac with python3.6 and my CI/CD runs on ubuntu python3.6. My workflow is as follows:

  • Add a dependency to requirements.in, and run pip-compile on the Mac to generate the pinned requirements.txt
  • Commit the pinned requirements.txt to the git repo
  • Checkout and run pip-sync on CI/CD or a target machine for installation
    This has been working fine.
    My package depends on jupyter, which internally needs ipython.

Currently, I am trying to install the package into a machine where only source installs are possible. In this case, I get an error when appnope is being installed that it supoprts Mac only.

I'm trying to understand what is the expected usage in such cases ? How do I avoid this issue ?

Notes:

  • ipython uses appnope for darwin
  • appnope's setup.py has a check for darwin
  • Installing appnope with a source distribution (tar.gz) on linux fails. Installing it with wheel succeeds.

So, my pip-sync fails when I do a source only installation for all my packages.

Environment Versions
  1. OS Type: MacOS 10.13 for pip-compile Centos7 for pip-sync
  2. Python version: $ python -V: Python 3.6.4 :: Anaconda, Inc.
  3. pip version: $ pip --version: pip 9.0.1
  4. pip-tools version: $ pip-compile --version: pip-compile, version 3.5.0
Steps to replicate
mac$ echo "ipython" > /tmp/req.in

mac$ pip-compile /tmp/req.in
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile /tmp/req.in
#
appnope==0.1.0            # via ipython
backcall==0.1.0           # via ipython
decorator==4.4.0          # via ipython, traitlets
ipython-genutils==0.2.0   # via traitlets
ipython==7.4.0
jedi==0.13.3              # via ipython
parso==0.4.0              # via jedi
pexpect==4.7.0            # via ipython
pickleshare==0.7.5        # via ipython
prompt-toolkit==2.0.9     # via ipython
ptyprocess==0.6.0         # via pexpect
pygments==2.3.1           # via ipython
six==1.12.0               # via prompt-toolkit, traitlets
traitlets==4.3.2          # via ipython
wcwidth==0.1.7            # via prompt-toolkit

appnope is added here. but installing it in linux from source fails:

centos$ pip install appnope
Collecting appnope
  Downloading https://files.pythonhosted.org/packages/87/a9/7985e6a53402f294c8f0e8eff3151a83f1fb901fa92909bb3ff29b4d22af/appnope-0.1.0-py2.py3-none-any.whl
Installing collected packages: appnope
Successfully installed appnope-0.1.0

centos$ pip install appnope-0.1.0.tar.gz
Processing appnope-0.1.0.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-1x2ukcp_/setup.py", line 17, in <module>
        raise ValueError("Only meant for install on OS X >= 10.9")
    ValueError: Only meant for install on OS X >= 10.9
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-1x2ukcp_/
@atugushev
Copy link
Member

atugushev commented Apr 24, 2019

Hello @AbdealiJK,

Thank you for raising the issue! Cross platform ability has been discussed in several issues. Here is also a good note in PR #651 (not merged though).

As a workaround, you can pin the appnope with a specific platform in a requirements.in separately, for example:

hostname$ cat << EOF > requirements.in
ipython
appnope; sys_platform == "darwin"
EOF

hostname$ pip-compile
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile
#
appnope==0.1.0 ; sys_platform == "darwin"
backcall==0.1.0           # via ipython
decorator==4.4.0          # via ipython, traitlets
ipython-genutils==0.2.0   # via traitlets
ipython==7.4.0
jedi==0.13.3              # via ipython
parso==0.4.0              # via jedi
pexpect==4.7.0            # via ipython
pickleshare==0.7.5        # via ipython
prompt-toolkit==2.0.9     # via ipython
ptyprocess==0.6.0         # via pexpect
pygments==2.3.1           # via ipython
six==1.12.0               # via prompt-toolkit, traitlets
traitlets==4.3.2          # via ipython
wcwidth==0.1.7            # via prompt-toolkit

Now you can ran pip-sync on every OS without an error. Hope it helps!

@AbdealiLoKo
Copy link
Contributor Author

My bad for not searching. closing as duplicate.

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

2 participants