clarete / forbiddenfruit

Patch built-in python objects

Home Page:https://clarete.li/forbiddenfruit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide wheel packages?

mristin opened this issue · comments

Hi,
I am trying to install forbiddenfruit on a Windows machine. (Forbiddenfruit is a dependency of CrossHair package which I am trying to originally install.) Unfortunately, forbiddenfruit needs to compile ffruit extension, see the error log below.

Any chance you could ship wheel packages along the source code so that Windows users do not have to compile the package (and don't have to install Visual Studio C++ 14)?

Is there a reason (apart from lack of time :)) that you didn't ship the wheel packages for Windows? Anything Posix specific? If not, would you like a pull request to include wheel packages on every release (e.g., as a Github Workflow)?

Here is the error log:

(venv) C:\Users\rist\workspace\pshanely\CrossHair>pip3 install .
Processing c:\users\rist\workspace\pshanely\crosshair
Collecting forbiddenfruit
  Using cached forbiddenfruit-0.1.3.tar.gz (31 kB)
Requirement already satisfied: typing-inspect in c:\users\rist\workspace\pshanely\crosshair\venv\lib\site-packages (from crosshair-tool==0.0.8) (0.6.0)
Collecting z3-solver==4.8.9.0
  Downloading z3_solver-4.8.9.0-py2.py3-none-win_amd64.whl (33.9 MB)
     |████████████████████████████████| 33.9 MB 3.2 MB/s
Requirement already satisfied: typing-extensions>=3.7.4 in c:\users\rist\workspace\pshanely\crosshair\venv\lib\site-packages (from typing-inspect->crosshair-tool==0.0.8) (3.7.4.3)
Requirement already satisfied: mypy-extensions>=0.3.0 in c:\users\rist\workspace\pshanely\crosshair\venv\lib\site-packages (from typing-inspect->crosshair-tool==0.0.8) (0.4.3)
Using legacy setup.py install for crosshair-tool, since package 'wheel' is not installed.
Using legacy setup.py install for forbiddenfruit, since package 'wheel' is not installed.
Installing collected packages: forbiddenfruit, z3-solver, crosshair-tool
    Running setup.py install for forbiddenfruit ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\rist\workspace\pshanely\crosshair\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\rist\\AppData\\Local\\Temp\\pip-install-01p_f0iq\\forbiddenfruit\\setup.py'"'"'; __file__='"'"'C:\\Users\\rist\\AppData\\Local\\Temp\\pip-install-01p_f0iq\\forbiddenfruit\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\rist\AppData\Local\Temp\pip-record-gddpmjm9\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\rist\workspace\pshanely\crosshair\venv\include\site\python3.8\forbiddenfruit'
         cwd: C:\Users\rist\AppData\Local\Temp\pip-install-01p_f0iq\forbiddenfruit\
    Complete output (10 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\forbiddenfruit
    copying forbiddenfruit\__init__.py -> build\lib.win-amd64-3.8\forbiddenfruit
    running build_ext
    building 'ffruit' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\rist\workspace\pshanely\crosshair\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\rist\\AppData\\Local\\Temp\\pip-install-01p_f0iq\\forbiddenfruit\\setup.py'"'"'; __file__='"'"'C:\\Users\\rist\\AppData\\Local\\Temp\\pip-install-01p_f0iq\\forbiddenfruit\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\rist\AppData\Local\Temp\pip-record-gddpmjm9\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\rist\workspace\pshanely\crosshair\venv\include\site\python3.8\forbiddenfruit' Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 20.3.3 is available.
You should consider upgrading via the 'c:\users\rist\workspace\pshanely\crosshair\venv\scripts\python.exe -m pip install --upgrade pip' command.

Here is an example how you can build and publish to Pypi triggered by Github releases: https://docs.github.com/en/actions/guides/building-and-testing-python#publishing-to-package-registries.

Producing wheels is as simple as:

python setup.py sdist bdist_wheel

Since wheels need to be built on the respective platform (wheels for Linux in Linux, wheels for Windows in Windows), you have to use multiple jobs in a Github workflow and share the data using artifacts: https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts#passing-data-between-jobs-in-a-workflow

There is also a CI action (runs on both Github and Travis) that takes care of all the details for you: https://github.com/joerick/cibuildwheel

+1 for this. Also, it looks to me as though the extension is only used for testing and can be disabled with an environment variable (setup.py)?

A workaround might be to set that env variable, and potentially a short-term fix might be to make it default to false?

Sorry about that guys, this issue has been fixed but I never rolled out the new package. I've now just done that!
if you pip install it again, it should pull the version 0.1.4 with the variable @pschanely pointed out already defaulting to empty! I'm going to close this issue, but please re-open it if that doesn't work!

Thank you for opening the issue and testing out the lib! 🙇🏾

@clarete are you sure the wheel packages are included?

It is not listed in the files on PyPI:
https://pypi.org/project/forbiddenfruit/#files

Hi @mristin 👋🏾 I ended up not really packaging it as a wheel because we don't really need the C extension. It is really only used in tests. So if you try to install that version, although there's no wheel package, you won't have to compile any C code. Which would fix the error message that you posted opening this issue.

Hi @clarete,
Just to confirm: I could install now forbiddenfruit on Windows withouth wheels & compilation. Thanks again for fixing the issue!