watchdog: second install of watchdog on non-macos incorrectly requires darwin dependencies

If I run pip install watchdog on a clean python environment it works fine and doesn’t install the pyobjc dependencies, although pip does output what look like warnings or errors:

watchdog 0.10.0 requires pyobjc-framework-Cocoa>=4.2.2, which is not installed.
watchdog 0.10.0 requires pyobjc-framework-FSEvents>=4.2.2, which is not installed.

If I run pip install watchdog again pip does see it as already installed but then tries to install the pyobjc dependencies and fails. Here’s the full command output:

(_venv) vagrant@ubuntu-bionic:~/py3$ python --version
Python 3.6.9
(_venv) vagrant@ubuntu-bionic:~/py3$ pip install watchdog
Collecting watchdog
  Using cached https://files.pythonhosted.org/packages/01/01/cc9b2fd111e19687dd42155f066718bccb414c8a728eb7df0b229742caf7/watchdog-0.10.0.tar.gz
  Ignoring pyobjc-framework-Cocoa: markers 'sys_platform == "darwin"' don't match your environment
  Ignoring pyobjc-framework-FSEvents: markers 'sys_platform == "darwin"' don't match your environment
Collecting pathtools>=0.1.1 (from watchdog)
  Using cached https://files.pythonhosted.org/packages/e7/7f/470d6fcdf23f9f3518f6b0b76be9df16dcc8630ad409947f8be2eb0ed13a/pathtools-0.1.2.tar.gz
Building wheels for collected packages: watchdog, pathtools
  Running setup.py bdist_wheel for watchdog ... done
  Stored in directory: /home/vagrant/.cache/pip/wheels/d4/74/90/4e0d4d5050776ce9a03e8a2c873e523b0149bf6412546dfc3f
  Running setup.py bdist_wheel for pathtools ... done
  Stored in directory: /home/vagrant/.cache/pip/wheels/0b/04/79/c3b0c3a0266a3cb4376da31e5bfe8bba0c489246968a68e843
Successfully built watchdog pathtools
watchdog 0.10.0 requires pyobjc-framework-Cocoa>=4.2.2, which is not installed.
watchdog 0.10.0 requires pyobjc-framework-FSEvents>=4.2.2, which is not installed.
Installing collected packages: pathtools, watchdog
Successfully installed pathtools-0.1.2 watchdog-0.10.0
You are using pip version 18.0, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(_venv) vagrant@ubuntu-bionic:~/py3$ pip install watchdog
Requirement already satisfied: watchdog in ./_venv/lib/python3.6/site-packages (0.10.0)
Requirement already satisfied: pathtools>=0.1.1 in ./_venv/lib/python3.6/site-packages (from watchdog) (0.1.2)
Collecting pyobjc-framework-Cocoa>=4.2.2 (from watchdog)
  Downloading https://files.pythonhosted.org/packages/7a/99/bfac679ee346f344bca72ee315249e56f4f34bc974345f66d7810380ce7a/pyobjc-framework-Cocoa-6.1.tar.gz (3.9MB)
    100% |████████████████████████████████| 3.9MB 4.1MB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-vnyl8c9t/pyobjc-framework-Cocoa/setup.py", line 25, in <module>
        extra_link_args=["-framework", "CoreFoundation"],
      File "/tmp/pip-install-vnyl8c9t/pyobjc-framework-Cocoa/pyobjc_setup.py", line 408, in Extension
        os_level = get_os_level()
      File "/tmp/pip-install-vnyl8c9t/pyobjc-framework-Cocoa/pyobjc_setup.py", line 218, in get_os_level
        pl = plistlib.readPlist("/System/Library/CoreServices/SystemVersion.plist")
      File "/usr/lib/python3.6/plistlib.py", line 162, in readPlist
        with _maybe_open(pathOrFile, 'rb') as fp:
      File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
        return next(self.gen)
      File "/usr/lib/python3.6/plistlib.py", line 120, in _maybe_open
        with open(pathOrFile, mode) as fp:
    FileNotFoundError: [Errno 2] No such file or directory: '/System/Library/CoreServices/SystemVersion.plist'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-vnyl8c9t/pyobjc-framework-Cocoa/
You are using pip version 18.0, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I have tested this with python 2.7 and 3.6 and the behavior is the same.

Additionally, if you try installing while the wheel version is cached, you also get the same error, even if watchdog is not installed:

(_venv) vagrant@ubuntu-bionic:~/py3$ pip install watchdog
Processing /home/vagrant/.cache/pip/wheels/d4/74/90/4e0d4d5050776ce9a03e8a2c873e523b0149bf6412546dfc3f/watchdog-0.10.0-cp36-none-any.whl
Collecting pyobjc-framework-FSEvents>=4.2.2
  Downloading pyobjc-framework-FSEvents-6.1.tar.gz (24 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/vagrant/py3/_venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2slm3k7e/pyobjc-framework-FSEvents/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2slm3k7e/pyobjc-framework-FSEvents/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-2slm3k7e/pyobjc-framework-FSEvents/pip-egg-info
         cwd: /tmp/pip-install-2slm3k7e/pyobjc-framework-FSEvents/
    Complete output (15 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-2slm3k7e/pyobjc-framework-FSEvents/setup.py", line 20, in <module>
        ext_modules=[Extension("FSEvents._callbacks", ["Modules/_callbacks.m"])],
      File "/tmp/pip-install-2slm3k7e/pyobjc-framework-FSEvents/pyobjc_setup.py", line 408, in Extension
        os_level = get_os_level()
      File "/tmp/pip-install-2slm3k7e/pyobjc-framework-FSEvents/pyobjc_setup.py", line 218, in get_os_level
        pl = plistlib.readPlist("/System/Library/CoreServices/SystemVersion.plist")
      File "/usr/lib/python3.6/plistlib.py", line 162, in readPlist
        with _maybe_open(pathOrFile, 'rb') as fp:
      File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
        return next(self.gen)
      File "/usr/lib/python3.6/plistlib.py", line 120, in _maybe_open
        with open(pathOrFile, mode) as fp:
    FileNotFoundError: [Errno 2] No such file or directory: '/System/Library/CoreServices/SystemVersion.plist'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Upgrading to the latest pip (20.0.2) exhibits the same error.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 20

Commits related to this issue

Most upvoted comments

I reported this as a pip issue #7673 yesterday, as it worked the first time, but failed when installing from cache. Good to see it has been resolved though. Thanks!

Excellent. I merge the fix and plan the new release. Thanks everyone 💪

That worked for me

Step 6/19 : COPY ./dist /tmp/packages
 ---> 514c8d5fa099
Step 7/19 : RUN pip install /tmp/packages/watchdog-0.10.1.tar.gz
 ---> Running in f41910d2b163
Processing /tmp/packages/watchdog-0.10.1.tar.gz
Building wheels for collected packages: watchdog
  Building wheel for watchdog (setup.py): started
  Building wheel for watchdog (setup.py): finished with status 'done'
  Created wheel for watchdog: filename=watchdog-0.10.1-py3-none-any.whl size=74335 sha256=4d79f96474d38cd114926837b838dcf4090fddd73df6cb63c7b25eb5b8cfaf07
  Stored in directory: /tmp/pip-ephem-wheel-cache-39p2a13c/wheels/fb/62/b0/3032ed076bd75e0ae5187a1e0cafb4ff3fdef28f3e5ea21c5c
Successfully built watchdog
Installing collected packages: watchdog
Successfully installed watchdog-0.10.1
Removing intermediate container f41910d2b163
 ---> 3178af77fdc6

From the fix-use-sys-platform branch if I just comment out the pyobjc requirements in install_requires it fixes the problem for me.

These seem like perfectly valid conditional requirement constructs so I still think there’s a pip bug to file here.