Error raised when trying to install Django - python

I'm trying to install Django into my project using the following requirements.txt file:
django>=4.1.0,<4.2.0
djangorestframework
pyyaml
requests
django-cors-headers
But, the following error is raised:
creating build/temp.macosx-10.14-arm64-cpython-38/lib
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Users/brendanahern/dev/drf/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c lib/zoneinfo_module.c -o build/temp.macosx-10.14-arm64-cpython-38/lib/zoneinfo_module.o -std=c99
lib/zoneinfo_module.c:1:10: fatal error: 'Python.h' file not found
#include "Python.h"
^~~~~~~~~~
1 error generated.
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: Failed building wheel for backports.zoneinfo
Successfully built pyyaml
Failed to build backports.zoneinfo
ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects
I am using a Mac with an M1 chip.
Answers on a similar question suggested that the error came from numpy and I needed to install it differently due to the M1 chip, but it didn't fix the issue.

Related

Export python output to password protected zip file?

I'm on the last step of a program that I have been creating. I have to export the output of my python program as a password protected zip file (I have been following these instructions). I was looking to use the pyminizip package to do so, but it will not install on my mac. The following error message appears in my terminal:
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
running bdist_wheel
running build
running build_ext
building 'pyminizip' extension
creating build
creating build/temp.macosx-10.9-universal2-3.10
creating build/temp.macosx-10.9-universal2-3.10/src
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11/contrib
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11/contrib/minizip
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -Isrc -Izlib-1.2.11 -Izlib-1.2.11/contrib/minizip -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/py_miniunz.c -o build/temp.macosx-10.9-universal2-3.10/src/py_miniunz.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
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: Failed building wheel for pyminizip
Running setup.py clean for pyminizip
Failed to build pyminizip
Installing collected packages: pyminizip
Running setup.py install for pyminizip ... error
error: subprocess-exited-with-error
× Running setup.py install for pyminizip did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
running install
running build
running build_ext
building 'pyminizip' extension
creating build
creating build/temp.macosx-10.9-universal2-3.10
creating build/temp.macosx-10.9-universal2-3.10/src
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11/contrib
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11/contrib/minizip
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -Isrc -Izlib-1.2.11 -Izlib-1.2.11/contrib/minizip -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/py_miniunz.c -o build/temp.macosx-10.9-universal2-3.10/src/py_miniunz.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
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.
╰─> pyminizip
Having no clue how to even deal with packages, I am a bit confused in terms of how to approach the issue. Is this because I have a mac, and if so, what other approach could I take to export my list as a password protected zip file?
This problem was simply solved by creating a virtual environment in vscode.

trouble install mysqlclient on ubuntu18.04

I am trying to install mysqlclient on ubuntu 18.04 for a Django project but having problem installing mysql. Here is the information from the terminal:
pip install mysqlclient
Collecting mysqlclient
----------------------------------------
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
2.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -
Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/opt/lampp/include/mysql -I/opt/lampp/include/mysql/mysql -I/usr/include/python2.7 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o
MySQLdb/_mysql.c:29:10: fatal error: mysql.h: No such file or directory`enter code here`
#include "mysql.h"
^~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
You'll have to install the MySQL headers.
sudo apt install libmysqlclient-dev
(and stop using Python 2.7, it's out of support in a month)

/usr/bin/ld: cannot find -lffi while installing cffi 1.11.5 package

enter code hereI'm trying to install paramiko module in my linux server. The pip is blocked on the server, So i am manually copying the package zips and installing them from setup.py
when i try installing paramiko i get
error: Could not find suitable distribution for Requirement.parse('pynacl>=1.0.1')
so i download the PyNaCl package, but i get
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cffi>=1.1.0')
pynacl needs cffi 1.1.0 above:
so while installing cffi1.11.5 i get the below error:
[root#homecffi-1.11.5]# python3.5 setup.py install
running install
---
---
installing library code to build/bdist.linux-x86_64/egg
--
--
building '_cffi_backend' extension
gcc -pthread -fno-strict-aliasing -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/local/lib/libffi-3.1/include -I/usr/local/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.5/c/_cffi_backend.o
c/_cffi_backend.c: In function ‘b_callback’:
c/_cffi_backend.c:5911: warning: ‘ffi_prep_closure’ is deprecated (declared at /usr/local/include/ffi.h:341)
gcc -pthread -shared build/temp.linux-x86_64-3.5/c/_cffi_backend.o -L$(libdir)/../lib64 -lffi -o build/lib.linux-x86_64-3.5/_cffi_backend.cpython-35m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lffi
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Can anyone help me with this?
If this is a Debian or Ubuntu machine,
sudo apt install libffi-dev
and then try again.
For other distributions, the installation method and package name may be different.

Getting an error message when trying to download pygame

I am trying to download pygame and am getting an error. I am on a mac computer on OS X 10.11.6. I have an updated version of pip and have Xcode already installed.The error comes up when I type in pip3 install pygame. The error is below...
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DENABLE_NEWBUF=1 -I/NEED_INC_PATH_FIX -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c src/scrap.c -o build/temp.macosx-10.6-intel-3.5/src/scrap.o
src/scrap.c:27:10: fatal error: 'SDL.h' file not found
#include "SDL.h"
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Most sites say to run this in terminal: xcode-select --install which will install xcode tools.
As for installing pygame with python3 on mac, it can be tricky sometimes, so if running the above in terminal stops that error but brings up another un-xcode-related one, I would suggest going here or here if that link fails.

Building pywt on ubuntu

I have problems building pywt from source on Ubuntu.
When I run python setup.py build, I get the following error:
running build
running build_py
running build_ext
Cython is not installed. Using compiled file: src/_pywt.pyx
building 'pywt._pywt' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPY_EXTENSION -Isrc -I/usr/local/include/python2.7 -c src/_pywt.c -o build/temp.linux-x86_64-2.7/src/_pywt.o
gcc: error: src/_pywt.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
error: command 'gcc' failed with exit status 4
When I run cython --version I get the following output:
Cython version 0.21.1
pywt can be installed as an Ubuntu package using apt-get:
sudo apt-get install python-pywt

Categories

Resources