0

I realize there are a lot of variations of these error questions out there, from my search nothing seemed to help.

I have recently pip installed some packages using my cmd prompt on windows. For instance pip installed Flask and had no issues. However I recently tried to pip install cs50 and Flask-SQLAlchemy and have gotten the same error with regards to greenlet.

My question is two fold. What does greenlet have to do with installing these packages. And secondly how can I fix this error so that I can pip install these packages?

Collecting Flask-SQLAlchemy
  Using cached Flask_SQLAlchemy-2.5.1-py2.py3-none-any.whl (17 kB)
Collecting SQLAlchemy>=0.8.0
Using cached SQLAlchemy-1.4.29.tar.gz (8.0 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: Flask>=0.10 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask-SQLAlchemy) (2.0.2)
Requirement already satisfied: itsdangerous>=2.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (2.0.1)
Requirement already satisfied: Jinja2>=3.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (3.0.3)
Requirement already satisfied: click>=7.1.2 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (8.0.3)
Requirement already satisfied: Werkzeug>=2.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (2.0.2)
Collecting greenlet!=0.4.17
  Using cached greenlet-1.1.2.tar.gz (91 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: colorama in c:\msys64\mingw64\lib\python3.9\site-packages (from click>=7.1.2->Flask>=0.10->Flask-SQLAlchemy) (0.4.4)
Requirement already satisfied: MarkupSafe>=2.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Jinja2>=3.0->Flask>=0.10->Flask-SQLAlchemy) (2.0.1)
Building wheels for collected packages: SQLAlchemy, greenlet
  Building wheel for SQLAlchemy (setup.py) ... done
  Created wheel for SQLAlchemy: filename=SQLAlchemy-1.4.29-cp39-cp39-win_amd64.whl size=1512539 sha256=25d3a12bbff4ff0c365154c700de44d089427650aea9b98e228c6077852eab61
  Stored in directory: c:\users\t\appdata\local\pip\cache\wheels\6d\94\a6\8bdac6f92ce851f71a9fa62934a06cf2b654700b5f258242c7
  Building wheel for greenlet (setup.py) ... error
  ERROR: Command errored out with exit status 1:

After this error I get a bunch more lines but some that stand out are

ERROR: Failed building wheel for greenlet
  Running setup.py clean for greenlet
Successfully built SQLAlchemy
Failed to build greenlet
Installing collected packages: greenlet, SQLAlchemy, Flask-SQLAlchemy
    Running setup.py install for greenlet ... error
    ERROR: Command errored out with exit status 1:

And

fatal error C1083: Cannot open include file: 'Python.h': No such file or directory
    error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.30.30705\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
    ----------------------------------------
ERROR: Command errored out with exit status 1:
Duke3e33
  • 151
  • 1
  • 3
  • 12
  • Flask_SQLAlchemy [uses](https://github.com/pallets/flask-sqlalchemy/blob/818c947b665206fe8edd8c1680b18ce83d3e4744/src/flask_sqlalchemy/__init__.py#L37) `greenlet`. – phd Jan 16 '22 at 15:53
  • For `Python.h` you need full Python source code: https://stackoverflow.com/a/21530768/7976758 , https://stackoverflow.com/search?q=%5Bpip%5D+%27Python.h%27%3A+No+such+file+or+directory – phd Jan 16 '22 at 16:00
  • Thank you for the responses, I guess I am still confused...I ran pip install on my command prompt and it didnt work. After reading through the second link you provided for `Python.h`, I have gotten more confused...What is the difference between the cygwin bash command I have on my computer and the cmd prompt? Why do I pip install in cmd prompt and not cygwin shell? To fix the header issue I tried to command offered in the solution in the cygwin shell `apy-cyg install python2-devel` and it says command not found. Where exactly is this header suppose to be installed... – Duke3e33 Jan 17 '22 at 13:55
  • I don't think you need anything from Cygwin (or else I'd closed the question as a duplicate). You need Python source code and you need to add its include directories to VC paths. I cannot help further as I don;t use Windows and never compiled Python extensions on Windows. – phd Jan 17 '22 at 14:07
  • gotcha. One more question if you are able to answer, why wouldn't `Python.h` come standard with an install of python...? – Duke3e33 Jan 17 '22 at 14:28
  • Because it's not required to run scripts. Because these days most major packages installed by `pip` are installed from precompiled binary wheels so users seldom needs to compile extension themselves. `greenlet` publishes a lot of [wheels](https://pypi.org/project/greenlet/1.1.2/#files); Python 27, 3.5-3.10, Linux, Windows, Intel, Amd64, Arm64, PowerPC64. – phd Jan 17 '22 at 15:47

0 Answers0