Question

Unable to install sqlalchemy python library

  • 11 September 2023
  • 1 reply
  • 400 views

Hi all,

Does anyone know how to fix his is error when execute ./fme python -m pip install sqlalchemy --target /Library/FME/2022.2/plugins :

 

INFORM: Using Python interpreter from `/Library/FME/2022.2/fmepython310/lib/libpython3.10.dylib' with PYTHONHOME `/Library/FME/2022.2/fmepython310'

INFORM: Python version 3.10 loaded successfully

Collecting sqlalchemy

 Using cached SQLAlchemy-2.0.20-cp310-cp310-macosx_10_9_x86_64.whl (2.0 MB)

Collecting greenlet!=0.4.17

 Using cached greenlet-2.0.2.tar.gz (164 kB)

 Preparing metadata (setup.py) ... done

Collecting typing-extensions>=4.2.0

 Using cached typing_extensions-4.7.1-py3-none-any.whl (33 kB)

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

 ╰─> [98 lines of output]

   running bdist_wheel

   running build

   running build_py

   creating build

   ...

   gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/kmcdougall/safe/tamoon-worktree/3rd/redistributable/free_use/python/cpython-3.10.6/../PLATFORM-macosx/python3.10/include/python3.10 -c src/greenlet/greenlet.cpp -o build/temp.macosx-10.15-x86_64-cpython-310/src/greenlet/greenlet.o --std=gnu++11

   src/greenlet/greenlet.cpp:16:10: fatal error: 'Python.h' file not found

   #include <Python.h>

        ^~~~~~~~~~

   1 error generated.

   error: command '/usr/bin/gcc' failed with exit code 1

   [end of output]

  

 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: typing-extensions, greenlet, sqlalchemy

 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

 ╰─> [100 lines of output]

   running install

   /Library/FME/2022.2/python/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

    warnings.warn(

   running build

   running build_py

   creating build

   ...

   gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/kmcdougall/safe/tamoon-worktree/3rd/redistributable/free_use/python/cpython-3.10.6/../PLATFORM-macosx/python3.10/include/python3.10 -c src/greenlet/greenlet.cpp -o build/temp.macosx-10.15-x86_64-cpython-310/src/greenlet/greenlet.o --std=gnu++11

   src/greenlet/greenlet.cpp:16:10: fatal error: 'Python.h' file not found

   #include <Python.h>

        ^~~~~~~~~~

   1 error generated.

   error: command '/usr/bin/gcc' failed with exit code 1

   [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.

 

[notice] A new release of pip available: 22.3.1 -> 23.2.1

[notice] To update, run: /Library/FME/2022.2/fmepython310/bin/python3 -m pip install --upgrade pip

 

Error in running the Python command 'python %0'

Program Terminating

 


1 reply

Userlevel 1
Badge +9

The specific combination of Greenlet version resolved (v2.0.2), OS platform (macosx_10_*_x86, wheels are apparently release-specific on Mac) and Python version (CPython 3.10) has not been published as a pre-compiled "wheel package", so pip is trying to compile it, but the Python installation that FME ships with is not configured for compilation. You could always install it in a separate Python 3.10 environment and copy it over to the FME Python plugins location manually.

 

EDIT: You can also run pip install --prefer-binary sqlalchemy, which causes pip to "Prefer older binary packages over newer source packages." when doing dependency resolution.

Reply