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

setup.py should not import pyscreeze #13

Closed
SpotlightKid opened this issue Nov 6, 2015 · 4 comments
Closed

setup.py should not import pyscreeze #13

SpotlightKid opened this issue Nov 6, 2015 · 4 comments

Comments

@SpotlightKid
Copy link

setup.py imports pyscreeze to get the version info. This then fails if the dependency PIL (Pillow) is not already installed when setup.py is run (which may be by pip).

Solution: put version info (and optionally any other distribution metadata) in an extra module file (e.g. version.py, release.py or metadata.py) and do not import it, but read it with:

data = {}
version_info = 'pyscreeze/version.py'
exec(compile(open(version_info).read(), version_info, 'exec'), {}, data)
version = data['__version__']

BTW, from pyscreeze.version import __version__ as version does also not work, since this will implicitly import pyscreeze/__init__.py.

This also prevents the possible problem where setup.py is run with an already installed version of pyscreeze and the version info is read from the installed package, rather from the directory, from which setup.py is run.

@tonygrue
Copy link

Hitting this issue when doing 'pip install -r requirements.txt' with a requirements.txt that includes pyautogui (which is dependant on pyscreeze); even when pillow is first listed in the requirements.txt. If I first 'pip install pillow' then install from my requirements.txt I can work around it.

@RattleyCooper
Copy link

No idea how to work around this. Trying to install pyautogui, and it fails when trying to install pyscreeze due to the from PIL import Image that is ran. Can't install pyautogui or pyscreeze due to this issue.

Just trying a simple pip install pyautogui.

@divick
Copy link

divick commented Apr 7, 2016

@Wykleph : Installing pillow before installing pyautogui makes it work.

@RattleyCooper
Copy link

@divkis01, I did try this when I was troubleshooting, however it did not work. I ended up giving up on this particular library, so I don't have any more information to provide.

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

4 participants