Error installing pygame on MacOS: 'longintrepr.h' file not found [duplicate] - python

This question already has answers here:
Unable to install Pygame using pip
(27 answers)
Closed 29 days ago.
I am trying to install the pygame library on my Mac running macOS 11.0 Big Sur, but I keep getting errors related to missing files, such as 'longintrepr.h' and 'pkg-config'. I have tried installing the library using pip3 and a virtual environment, but I am still encountering the same issues. I am looking for a solution to successfully install the pygame library on my Mac.
#include "longintrepr.h"
^~~~~~~~~~~~~~~
1 error generated.
---
For help with compilation see:
https://www.pygame.org/wiki/MacCompile
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
error: command '/usr/bin/clang' 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.
╰─> pygame
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I have the newest version of python3 installed.
I tried to install pygame using pip on my MacOS machine but I encountered an error "src_c/_sdl2/sdl2.c:211:12: fatal error: 'longintrepr.h' file not found" during the installation process. I also tried creating a virtual environment and installing pygame there but still encountered the same error. I was expecting the installation process to complete successfully without any errors.

On the official pygame repo, there's a huge thread regarding installation of pygame in python 3.11 (latest version) not working properly yet.
Try installing pip install pygame --pre for now, which is going to install a developmental release of the newest, prereleased pygame version, or if you want stability using an older version of python also works.

Related

Error in building wheel for cryptography while installing firebase-admin on raspberry pi 3

I was installing firebase-admin using pip on my raspberry pi 3b+ using the following command:
pip3 install firebase-admin
However it always ends with an error saying "Error building wheel for cryptography"
Here is the full error message:
/tmp/pip-build-env-k7qo7p54/overlay/lib/python3.7/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning: Installing 'cryptography.hazmat.bindings._rust' as data is deprecated, please list it in packages.
!!
############################
# Package would be ignored #
############################
Python recognizes 'cryptography.hazmat.bindings._rust' as an importable package,
but it is not listed in the `packages` configuration of setuptools.
'cryptography.hazmat.bindings._rust' has been automatically added to the distribution only
because it may contain data files, but this behavior is likely to change
in future versions of setuptools (and therefore is considered deprecated).
Please make sure that 'cryptography.hazmat.bindings._rust' is included as a package by using
the `packages` configuration field or the proper discovery methods
(for example by using `find_namespace_packages(...)`/`find_namespace:`
instead of `find_packages(...)`/`find:`).
You can read more about "package discovery" and "data files" on setuptools
documentation page.
!!
check.warn(importable)
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation/ for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq/
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation/#rust
Python: 3.7.3
platform: Linux-5.10.103-v7+-armv7l-with-debian-10.13
pip: n/a
setuptools: 67.0.0
setuptools_rust: 1.5.2
rustc: n/a
=============================DEBUG ASSISTANCE=============================
error: can't find Rust compiler
If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
To update pip, run:
pip install --upgrade pip
and then retry package installation.
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
This package requires Rust >=1.48.0.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects
I have tried different commands like:
pip3 install firebase-admin
or
python -m pip install firebase-admin
I have upgraded pip and tried again, but still it didn't work
I faced a similar problem long time ago and solved by installing openssl. Tried it this time, it didn't work
Also tried installing rust compiler and using it but it didn't work
I am using Raspbian OS Buster on my Raspberry Pi 3
I have tried fresh installs of the OS
Still the same problem occurs

I am running into errors installing a requirements.txt. The issue I am having is with pillow

I am relatively new to the world of coding and am mostly self taught. Currently I am working on a project via a repository from GitHub. One of the steps in working with the code is to install python dependencies via a requirements.txt
I am currently running into errors with pillow. I am working in windows, and currently have python 3.9.7 and conda 4.13.0. When I run the python -m pip install --upgrade -r requirements.txt i get errors as follows:
1) Building wheels for collected packages: pillow
Building wheel for pillow (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [189 lines of output]
C:\Users\kj\AppData\Local\Temp\pip-install-hsdc08bl\pillow_07ce73d2c2484297acb81cb082ed4b48\setup.py:29: RuntimeWarning: Pillow does not yet support Python 3.9 and does not yet provide prebuilt Windows binaries. We do not recommend building from source on Windows.
2) During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\kj\AppData\Local\Temp\pip-install-hsdc08bl\pillow_07ce73d2c2484297acb81cb082ed4b48\setup.py", line 888, in <module>
raise RequiredDependencyException(msg)
__main__.RequiredDependencyException:
The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.
Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pillow
3) Running setup.py clean for pillow
Failed to build pillow
Installing collected packages: pillow, h5py, pandas, matplotlib, sklearn, scikit-image
Attempting uninstall: pillow
Found existing installation: Pillow 9.1.1
Uninstalling Pillow-9.1.1:
Successfully uninstalled Pillow-9.1.1
Running setup.py install for pillow ... error
error: subprocess-exited-with-error
× Running setup.py install for pillow did not run successfully.
│ exit code: 1
╰─> [193 lines of output]
C:\Users\kj\AppData\Local\Temp\pip-install-hsdc08bl\pillow_07ce73d2c2484297acb81cb082ed4b48\setup.py:29: RuntimeWarning: Pillow does not yet support Python 3.9 and does not yet provide prebuilt Windows binaries. We do not recommend building from source on Windows.
4) The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.
Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: No metadata found in c:\programdata\anaconda3\lib\site-packages
Rolling back uninstall of pillow
Moving to c:\programdata\anaconda3\lib\site-packages\pil\
from C:\ProgramData\Anaconda3\Lib\site-packages\~il
Moving to c:\programdata\anaconda3\lib\site-packages\pillow-9.1.1.dist-info\
from C:\ProgramData\Anaconda3\Lib\site-packages\~illow-9.1.1.dist-info
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pillow
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
These are all the errors I get when I run the install of requirements.txt. I have done some research on my own before looking for help as there are similar questions I have come across. One issue is that pillow does not yet support python 3.9. However, on pillows readthedoc it claims that python 3.9 is supported by pillow >=9.0, and I have pillow 9.1.1 installed. Another issue I see is the headers or library files could not be found for zlib, yet I have used conda install -c anaconda zlib.
To reiterate, I am relatively still a beginner with code. I would appreciate any friendly advice with my current issues.
Thank you
When installing this library, pip tried to find a pre-compiled binary (bdist_wheel) but couldn't find one that matches your python version and OS. So it tried to build it from source, but you don't have zlib installed on your machine. zlib is another program that is used in the python build process. You can install it for windows from here, or I think it is bundled with Python if you install Python using the "Full Installer" as described here: https://docs.python.org/3/using/windows.html

ERROR: failed building wheel when installing spectral-cube (astropy)

I'm trying to install the package spectral-cube from the astropy project using pip (22.0.4). I get a long error which ends with this:
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for casa-formats-io.
Failed to build casa-formats-io.
ERROR: Could not build wheels for casa-formats-io, which is required to install pyproject.toml-based projects
Even after downloading casa-formats-io from their github I still get this error.
I've also tried installing this using conda, but the error is the same.
I'm using MacOS 12.3. But I had the problem with older versions.
I'm kind of confused as to what I can do.
Thanks for the help!
I was able to fix my own problem. The error appeared because the package I was trying to download wasn't available/compatible with the newest python version (3.10). So, I simply uninstalled Python and downloaded an older version (3.8).
Thanks anyways :)

Error installing pyQt5: error: metadata-generation-failed

I was tring to install PyQt5 and a get this error:
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I've tried using brew install pyqt and installing pyqt6 went out just fine. What's wrong.
Ok, I faced this issue with python 3.10.4 and after searching I found two solutions for this problem because this problem not being only with turtle but for other libraries.
#Note: These solutions for downloading any library if you have a problem mentioned above and this problem faced me in windows CMD.
So you could try this way:
pip install <libraryName>==0.0.1
0.0.1 This is the last version of the library so you should find the version of the library that you want to install for this purpose, you can find the version of the library using this command:
pip show module <name_of_the_library>
another solution that could work is using --use-deprecated=backtrack-on-build-failures
Example:
pip install turtle --use-deprecated=backtrack-on-build-failures
Hope to help you.

difficulty with psycopg2 on macOS Catalina 10.15.5 [duplicate]

This question already has an answer here:
Error code when installing psycopg2 in requirements.txt in django
(1 answer)
Closed 2 years ago.
I have a finished simple django blog application that I am in the process of deploying to heroku.
I have a live application now, but my static css files weren't included. I think that I've identified (part of) the problem in my settings.py file where django_heroku is unable to be imported.
When i try to pip install django-heroku, I error out at the psycopg2:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
It seems that I have homebrew installed and have up-to-date versions of gcc, openssl, and xcode.
Does anyone have any suggestions on what I could try next?
I have run into issues with psycopg2 and MacOS in the past. Have you tried to install the precompiled version?
pip install psycopg2-binary
That usually clears things up for me!

Categories