5

Please see my previous question here. I have spent all day searching on what my issues are and still running into pip install issues. This time my error message is a little different. What I have done since my previous post:

  1. Made sure that C:\mysys64\mingw64\bin was added to my path under system environment variables
  2. edit the c_cpp_properties.json specifically the "intelliSenseMode" in VSCode from "windows-msvc-x64" to "windows-gcc-x64"
  3. re-check my Python.h file under directory C:\msys64\mingw64\include\python3.9\Python.h to make sure the errors were gone by the #include <unistd.h> which they were.
  4. Retry pip install Flask-SQLAlchemy and now I get the following errors...

Terminal window output

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=80ef3cf51b84f92e8117a57097054fcb25807ebf7755115d7df299bacf17a09d
  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:
   command: 'C:\msys64\mingw64\bin\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\t\\AppData\\Local\\Temp\\pip-install-p182wkp5\\greenlet_78bb1f8ef93a452d8f0a86edfe24f6dd\\setup.py'"'"'; __file__='"'"'C:\\Users\\t\\AppData\\Local\\Temp\\pip-install-p182wkp5\\greenlet_78bb1f8ef93a452d8f0a86edfe24f6dd\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\t\AppData\Local\Temp\pip-wheel-iwgszyll'
       cwd: C:\Users\t\AppData\Local\Temp\pip-install-p182wkp5\greenlet_78bb1f8ef93a452d8f0a86edfe24f6dd\
  Complete output (69 lines):

Then some other errors like so

"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\msys64\mingw64\include -IC:\msys64\mingw64\include\python3.9 "-IC:\Program 
Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /Tcsrc/greenlet/greenlet.c /Fobuild\temp.win-amd64-3.9\Release\src/greenlet/greenlet.obj
  greenlet.c
  C:\msys64\mingw64\include\python3.9\Python.h(36): fatal error C1083: Cannot open include file: 'unistd.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: 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:

However there is no longer a squiggly error line under #include <unistd.h> in my Python.h file. Mind you I have no clue what I am doing in trying to fix this. Please let me know if there is a solution.

Update 2022.02.01: I have unistalled version 3.9.7 of python and installed version 3.10.2. I have updated pip to version 22.02.2 and have tried the solutions given below. After downloading the wheels greenlet‑1.1.2‑cp310‑cp310‑win32.whl and greenlet‑1.1.2‑cp310‑cp310‑win_amd64.whl I went to my downloads folder and ran the commands and follows:

C:\Users\t\Downloads>C:\msys64\mingw64\bin\python.exe -m pip install greenlet-1.1.2-cp310-cp310-win_amd64.whl
ERROR: greenlet-1.1.2-cp310-cp310-win_amd64.whl is not a supported wheel on this platform.

C:\Users\t\Downloads>C:\msys64\mingw64\bin\python.exe -m pip install greenlet-1.1.2-cp310-cp310-win32.whl
ERROR: greenlet-1.1.2-cp310-cp310-win32.whl is not a supported wheel on this platform.

After that didnt work I tried to pip install greenlet directly with pip install greenlet and got the following output:

Building wheels for collected packages: greenlet
  Building wheel for greenlet (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [69 lines of output]

and further down

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for greenlet
  Running setup.py clean for greenlet
Failed to build greenlet
Installing collected packages: greenlet
  Running setup.py install for greenlet ... error
  error: subprocess-exited-with-error

  × Running setup.py install for greenlet did not run successfully.
  │ exit code: 1
  ╰─> [71 lines of output]

and yet further down (hoping this may shine some light on the problem)

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
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> greenlet

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Duke3e33
  • 151
  • 1
  • 3
  • 12
  • FWIW, why not show us your errors when you **only** `pip install SQLAlchemy`? The rest, Jinja, Flask, etc... is just adding noise. – JL Peyret Jan 17 '22 at 17:43
  • You may have to tweak your pip install command, for SQLAlchemy only, with the `-I` and `-L` flags. For example, for Pygraphviz, the documentation gave an [example](https://pygraphviz.github.io/documentation/stable/install.html#windows). You may need to try a few times, I had to point *above* where I originally thought. – JL Peyret Jan 17 '22 at 18:12
  • yes sorry I figured since I am no expert, showing more might be better. and I wasted time updating Visual Studio and not VSCode...anyway here is where I am at. I followed [this](https://packaging.python.org/en/latest/tutorials/installing-packages/) guide. I ran `-m pip install --upgrade pip setuptools wheel` and got this `WARNING: The script wheel.exe is installed in 'C:\Users\t\AppData\Roaming\Python\Python39\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.` – Duke3e33 Jan 17 '22 at 19:24
  • And this `WARNING: The scripts pip.exe, pip3.9.exe and pip3.exe are installed in 'C:\Users\t\AppData\Roaming\Python\Python39\Scripts' which is not on PATH.` Not sure if that could be an issue? I then ran `py -m pip install SQLAlchemy` command and got `Installing collected packages: greenlet, SQLAlchemy Successfully installed SQLAlchemy-1.4.29 greenlet-1.1.2` but when I ran `pip list` command neither package was listed... I am at a loss – Duke3e33 Jan 17 '22 at 19:26

5 Answers5

2

Following commands solved the issue on my m1 Mac -

- brew install graphviz
- python3 -m pip install \           
    --global-option=build_ext \
    --global-option="-I$(brew --prefix graphviz)/include/" \
    --global-option="-L$(brew --prefix graphviz)/lib/" \
    pygraphviz
joydeba
  • 778
  • 1
  • 9
  • 24
0

You can simply download an appropriate whl file from here and install it.

For you greenlet‑1.1.2‑cp39‑cp39‑win_amd64.whl should be correct. After downloading, cd to your download directory and run

C:\msys64\mingw64\bin\python.exe -m pip install greenlet‑1.1.2‑cp39‑cp39‑win_amd64.whl

Then try your original installation again.

Note

There is also a whl file for Flask_SQLAlchemy‑2.5.1‑py3‑none‑any.whl available on the same website. You could also download and install that

FlyingTeller
  • 17,638
  • 3
  • 38
  • 53
  • 1
    Hi, I get the following error when running the command from my downloads `C:\Users\t\Downloads>C:\msys64\mingw64\bin\python.exe -m pip install greenlet-1.1.2-cp39-cp39-win_amd64.whl ERROR: greenlet-1.1.2-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.` – Duke3e33 Jan 17 '22 at 16:53
0

The pip in the py -m pip is different from the pip in the pip list. You can through py -m pip --version and pip --version to get the pip locations.

I can install the greenlet package successfully through:

pip install greenlet --no-cache-dir

I am using python310, It looks like have some problems with python39. If it does not work, as @FlyingTeller has suggested, you can download it manually.

As you described greenlet-1.1.2-cp39-cp39-win_amd64.whl does not work, so have you tried greenlet‑1.1.2‑cp39‑cp39‑win32.whl?

>>> import platform
>>> platform.architecture()

You can get architecture through the above codes.

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13
  • I also got the same error with `win32` wheel. `C:\msys64\mingw64\bin\python.exe -m pip install greenlet-1.1.2-cp39-cp39-win32.whl ERROR: greenlet-1.1.2-cp39-cp39-win32.whl is not a supported wheel on this platform.` – Duke3e33 Jan 18 '22 at 09:48
  • to download manually are you suggesting I get it from the source file type from [here](https://pypi.org/project/greenlet/#files)? – Duke3e33 Jan 18 '22 at 09:51
  • @Duke3e33 Sorry for being late, what's the result of the `platform.architecture()`? – Steven-MSFT Jan 19 '22 at 01:51
  • Is this the information you are looking for? After running that command this is the output `>>> import platform >>> platform.architecture() ('64bit', 'WindowsPE') >>>` – Duke3e33 Jan 19 '22 at 15:33
  • @msys64 Sorry, but could you try to install a normal python? instead of which related to msys64? – Steven-MSFT Jan 20 '22 at 02:10
  • Sorry @steven-MSFT is there anyway you could be more specific as I am still no expert on this. What do you mean install a normal python? – Duke3e33 Jan 20 '22 at 15:00
  • can we revisit this? I have downloaded python 3.10.2 and tried to pip install again and still have issues, however with the newer version of pip, I have gotten some more information on my error message. Please see update – Duke3e33 Feb 01 '22 at 15:22
0

I updated pip, setuptools and wheel and it it solved the problem.

pip install --upgrade pip
pip install --upgrade setuptools wheel

note: if your pip is aliased as pip3 (Python 3) use pip3 instead of pip

 pip3 install --upgrade pip
 pip3 install --upgrade setuptools wheel

refer to this link for more information: https://bobbyhadz.com/blog/python-error-legacy-install-failure

0

I had issues to install greenlet 2.0.1 in PyCharm on Mac M1.

I've upgraded:

pip install --upgrade pip

pip install --upgrade setuptools wheel

And thanks to @joydeba comment - I've installed Homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

*Follow the instructions at the end of installation

After these steps I was able to install greenlet in PyCharm with no problem!