How to fix pynput installation error on pop os? - python

I had a freash installation of pop os, installed pip and I updated everything usig the following command
sudo apt update
sudo apt upgrade
now I want to install the pynput module so I tried the following command
pip install pynput
But I got the following error
Collecting pynput
Using cached pynput-1.7.3-py2.py3-none-any.whl (99 kB)
Collecting evdev>=1.3; "linux" in sys_platform
Using cached evdev-1.4.0.tar.gz (26 kB)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from pynput) (1.15.0)
Requirement already satisfied: python-xlib>=0.17; "linux" in sys_platform in /usr/lib/python3/dist-packages (from pynput) (0.27)
Building wheels for collected packages: evdev
Building wheel for evdev (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x6x_dhp2/evdev/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x6x_dhp2/evdev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-98m4gy5x
cwd: /tmp/pip-install-x6x_dhp2/evdev/
Complete output (29 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/evdev
copying evdev/__init__.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/ecodes.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/events.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/ff.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/uinput.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/eventio_async.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/util.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/genecodes.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/evtest.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/eventio.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/device.py -> build/lib.linux-x86_64-3.8/evdev
running build_ext
running build_ecodes
writing ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
building 'evdev._input' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/evdev
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c evdev/input.c -o build/temp.linux-x86_64-3.8/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
evdev/input.c:10:10: fatal error: Python.h: No such file or directory
10 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for evdev
Running setup.py clean for evdev
Failed to build evdev
Installing collected packages: evdev, pynput
Running setup.py install for evdev ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] =
What to do now?

Related

(python) Error while installing psycopg2 Ubuntu 20.04

I need to use psycopg2 package in python, Im trying to install it but I keep getting an error message while doing it. Not sure what the problem is since I've already installed pip.
This is the command I'm trying to run:
(venv) daniel#daniel-G5-5587:~/PycharmProjects/MIA_practica1$ pip3 install psycopg2
Any ideas? I'm attempting to Connect to PostgreSQL from Python.
I'm using Pycharm.
The error message I get is the following:
Collecting psycopg2
Using cached psycopg2-2.9.1.tar.gz (379 kB)
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/daniel/PycharmProjects/MIA_Practica1/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x4wdi5s2/psycopg2_88a40f4af9bf4ada932e1b3b5ce407f1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x4wdi5s2/psycopg2_88a40f4af9bf4ada932e1b3b5ce407f1/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 /tmp/pip-wheel-pqnxooo7
cwd: /tmp/pip-install-x4wdi5s2/psycopg2_88a40f4af9bf4ada932e1b3b5ce407f1/
Complete output (38 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.9/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/psycopg
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.9.1 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=120008 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/home/daniel/PycharmProjects/MIA_Practica1/venv/include -I/usr/include/python3.9 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -I/usr/include/libxml2 -I/usr/include/mit-krb5 -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-3.9/psycopg/adapter_asis.o -Wdeclaration-after-statement
In file included from psycopg/adapter_asis.c:28:
./psycopg/psycopg.h:35:10: fatal error: Python.h: No such file or directory
35 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for psycopg2
Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /home/daniel/PycharmProjects/MIA_Practica1/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x4wdi5s2/psycopg2_88a40f4af9bf4ada932e1b3b5ce407f1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x4wdi5s2/psycopg2_88a40f4af9bf4ada932e1b3b5ce407f1/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'"'"'))' install --record /tmp/pip-record-dg3pm2ke/install-record.txt --single-version-externally-managed --compile --install-headers /home/daniel/PycharmProjects/MIA_Practica1/venv/include/site/python3.9/psycopg2
cwd: /tmp/pip-install-x4wdi5s2/psycopg2_88a40f4af9bf4ada932e1b3b5ce407f1/
Complete output (38 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.9/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.9/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/psycopg
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.9.1 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=120008 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/home/daniel/PycharmProjects/MIA_Practica1/venv/include -I/usr/include/python3.9 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -I/usr/include/libxml2 -I/usr/include/mit-krb5 -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-3.9/psycopg/adapter_asis.o -Wdeclaration-after-statement
In file included from psycopg/adapter_asis.c:28:
./psycopg/psycopg.h:35:10: fatal error: Python.h: No such file or directory
35 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/daniel/PycharmProjects/MIA_Practica1/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x4wdi5s2/psycopg2_88a40f4af9bf4ada932e1b3b5ce407f1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x4wdi5s2/psycopg2_88a40f4af9bf4ada932e1b3b5ce407f1/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'"'"'))' install --record /tmp/pip-record-dg3pm2ke/install-record.txt --single-version-externally-managed --compile --install-headers /home/daniel/PycharmProjects/MIA_Practica1/venv/include/site/python3.9/psycopg2 Check the logs for full command output.
WARNING: You are using pip version 21.1.2; however, version 21.2.4 is available.
You should consider upgrading via the '/home/daniel/PycharmProjects/MIA_Practica1/venv/bin/python -m pip install --upgrade pip' command.

Unable to install sasl on MAC

In order to connect to Hive data warehouse from python.
Using pyhive requires sasl - ModuleNotFoundError: No module named 'sasl'
Installing sasl fails with errors below
Python 3.9.4
installed gcc, libsasl2
MACOS Mojave v 10.14
pip3 install sasl
Collecting sasl
Using cached sasl-0.2.1.tar.gz (30 kB)
Requirement already satisfied: six in /usr/local/lib/python3.9/site-packages (from sasl) (1.15.0)
Building wheels for collected packages: sasl
Building wheel for sasl (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python#3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7l/zbp16k6s11v5rypxj86mq_z00000gn/T/pip-install-3a1mge3r/sasl_ebeeb9cd2f6b4067a93195d45bbf68c1/setup.py'"'"'; __file__='"'"'/private/var/folders/7l/zbp16k6s11v5rypxj86mq_z00000gn/T/pip-install-3a1mge3r/sasl_ebeeb9cd2f6b4067a93195d45bbf68c1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/7l/zbp16k6s11v5rypxj86mq_z00000gn/T/pip-wheel-r3vsh0mm
cwd: /private/var/folders/7l/zbp16k6s11v5rypxj86mq_z00000gn/T/pip-install-3a1mge3r/sasl_ebeeb9cd2f6b4067a93195d45bbf68c1/
Complete output (333 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.9
creating build/lib.macosx-10.14-x86_64-3.9/sasl
copying sasl/__init__.py -> build/lib.macosx-10.14-x86_64-3.9/sasl
running egg_info
writing sasl.egg-info/PKG-INFO
writing dependency_links to sasl.egg-info/dependency_links.txt
writing requirements to sasl.egg-info/requires.txt
writing top-level names to sasl.egg-info/top_level.txt
reading manifest file 'sasl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sasl.egg-info/SOURCES.txt'
copying sasl/saslwrapper.cpp -> build/lib.macosx-10.14-x86_64-3.9/sasl
copying sasl/saslwrapper.h -> build/lib.macosx-10.14-x86_64-3.9/sasl
copying sasl/saslwrapper.pyx -> build/lib.macosx-10.14-x86_64-3.9/sasl
running build_ext
building 'sasl.saslwrapper' extension
creating build/temp.macosx-10.14-x86_64-3.9
creating build/temp.macosx-10.14-x86_64-3.9/sasl
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Isasl -I/usr/local/include -I/usr/local/opt/openssl#1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python#3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c sasl/saslwrapper.cpp -o build/temp.macosx-10.14-x86_64-3.9/sasl/saslwrapper.o
In file included from sasl/saslwrapper.cpp:254:
sasl/saslwrapper.h:36:35: warning: 'sasl_dispose' is deprecated: first deprecated in macOS 10.11 [-Wdeprecated-declarations]
~ClientImpl() { if (conn) sasl_dispose(&conn); conn = 0; }
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sasl/sasl.h:746:18: note: 'sasl_dispose' has been explicitly marked deprecated here
LIBSASL_API void sasl_dispose(sasl_conn_t **pconn) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_11,__IPHONE_NA,__IPHONE_NA);
^
In file included from sasl/saslwrapper.cpp:254:
sasl/saslwrapper.h:179:18: warning: 'sasl_client_init' is deprecated: first deprecated in macOS 10.11 [-Wdeprecated-declarations]
result = sasl_client_init(0);
....
It doesn't support Python3.9 yet
Python 3.7 works
Thank you for your attention folks :)

unable to install psycopg2 due to large error

I'm trying to install psycopg2 but I keep getting this error:
Collecting psycopg2
Using cached psycopg2-2.8.5.tar.gz (380 kB)
Using legacy setup.py install for psycopg2, since package 'wheel' is not installed.
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /home/yovel/PycharmProjects/scr/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8vyzoc4h/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8vyzoc4h/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-fq16err7/install-record.txt --single-version-externally-managed --compile --install-headers /home/yovel/PycharmProjects/scr/venv/include/site/python3.8/psycopg2
cwd: /tmp/pip-install-8vyzoc4h/psycopg2/
Complete output (40 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.5 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120002 -DHAVE_LO64=1 -I/home/yovel/PycharmProjects/scr/venv/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:28:
./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory
36 | #include <libpq-fe.h>
| ^~~~~~~~~~~~
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/yovel/PycharmProjects/scr/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8vyzoc4h/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8vyzoc4h/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-fq16err7/install-record.txt --single-version-externally-managed --compile --install-headers /home/yovel/PycharmProjects/scr/venv/include/site/python3.8/psycopg2 Check the logs for full command output.
I can install and use it using psycopg2-binary but I need to install this because it's a dependency (for django-heroku).
I tried installing libpq-dev but got this error:
The following packages have unmet dependencies:
libpq-dev : Depends: libpq5 (= 12.2-4) but 12.3-1.pgdg20.04+1 is to be installed
E: Unable to correct problems, you have held broken packages
and using sudo apt-get install libpq5
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.

Running setup.py install for regex ... error is driving me crazy

I am begging for help! I cannot get anything to work in anaconda anymore and I am trying to resolve it since days. I get the following error when I try to install several packages:
Building wheel for regex (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /opt/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wc/1pgwt_g16sn0026xr90vh_x80000gn/T/pip-install-6dc2clpx/regex/setup.py'"'"'; __file__='"'"'/private/var/folders/wc/1pgwt_g16sn0026xr90vh_x80000gn/T/pip-install-6dc2clpx/regex/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/wc/1pgwt_g16sn0026xr90vh_x80000gn/T/pip-wheel-r01lufl5
cwd: /private/var/folders/wc/1pgwt_g16sn0026xr90vh_x80000gn/T/pip-install-6dc2clpx/regex/
Complete output (17 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/regex
copying regex_3/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/regex
copying regex_3/regex.py -> build/lib.macosx-10.9-x86_64-3.7/regex
copying regex_3/_regex_core.py -> build/lib.macosx-10.9-x86_64-3.7/regex
copying regex_3/test_regex.py -> build/lib.macosx-10.9-x86_64-3.7/regex
running build_ext
building 'regex._regex' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/regex_3
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/anaconda3/include -arch x86_64 -I/opt/anaconda3/include -arch x86_64 -I/opt/anaconda3/include/python3.7m -c regex_3/_regex.c -o build/temp.macosx-10.9-x86_64-3.7/regex_3/_regex.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for regex
I tried everything. I uninstalled anaconda, I tried pip install regex NOTHING works. I am desperate. I cannot work since days. Please help me.
Make sure regex version is up to date in requirements.txt. For me it works when I set regex==2022.3.2.

cannot instal soundfile in datalab

i want install sndfile to successfully install another package (musdb), but when I tried following instructions on https://cloud.google.com/datalab/docs/how-to/adding-libraries
!pip install sndfile
It gives me the following error:
{Collecting sndfile
Using cached https://files.pythonhosted.org/packages/db/ce/797cacd78490aa9de2e0e119491079d380e2fbbd7a1c5057c9fb2120a643/sndfile-0.2.0.tar.gz
Requirement already satisfied: cffi>=1.0.0 in /usr/local/envs/py2env/lib/python2.7/site-packages (from sndfile) (1.11.5)
Requirement already satisfied: pycparser in /usr/local/envs/py2env/lib/python2.7/site-packages (from cffi>=1.0.0->sndfile) (2.18)
Building wheels for collected packages: sndfile
Running setup.py bdist_wheel for sndfile ... error
Complete output from command /usr/local/envs/py2env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-NZx2D1/sndfile/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-YWj7At --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/sndfile
copying sndfile/__init__.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/build.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/io.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/vio.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/formats.py -> build/lib.linux-x86_64-2.7/sndfile
running build_ext
generating cffi module 'build/temp.linux-x86_64-2.7/sndfile._sndfile.c'
creating build/temp.linux-x86_64-2.7
building 'sndfile._sndfile' extension
creating build/temp.linux-x86_64-2.7/build
creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
gcc -pthread -B /usr/local/envs/py2env/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/envs/py2env/include/python2.7 -c
build/temp.linux-x86_64-2.7/sndfile._sndfile.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/sndfile._sndfile.o
build/temp.linux-x86_64-2.7/sndfile._sndfile.c:494:21: fatal error: sndfile.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Failed building wheel for sndfile
Running setup.py clean for sndfile
Failed to build sndfile
Installing collected packages: sndfile
Running setup.py install for sndfile ... error
Complete output from command /usr/local/envs/py2env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-NZx2D1/sndfile/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-FMQzpS/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/sndfile
copying sndfile/__init__.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/build.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/io.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/vio.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/formats.py -> build/lib.linux-x86_64-2.7/sndfile
running build_ext
generating cffi module 'build/temp.linux-x86_64-2.7/sndfile._sndfile.c'
creating build/temp.linux-x86_64-2.7
building 'sndfile._sndfile' extension
creating build/temp.linux-x86_64-2.7/build
creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
gcc -pthread -B /usr/local/envs/py2env/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/envs/py2env/include/python2.7 -c build/temp.linux-x86_64-2.7/sndfile._sndfile.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/sndfile._sndfile.o
build/temp.linux-x86_64-2.7/sndfile._sndfile.c:494:21: fatal error: sndfile.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/local/envs/py2env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-NZx2D1/sndfile/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-FMQzpS/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-NZx2D1/sndfile/}
I tried to google around, it either suggested to download via conda, which seems difficult with datalab, or with the following command
sudo apt-get install libsndfile1
which gives me a syntax error in datalab.
I need this library since I am trying to import musdb and after installing, when I try to import, it gives me the following error:
import musdb
OSErrorTraceback (most recent call last)
in <module> . ()
----> 1 import musdb
/usr/local/envs/py2env/lib/python2.7/site-packages/musdb/__init__.py in <module>()
1 from __future__ import print_function
----> 2 from .audio_classes import Track, Source, Target
3 from os import path as op
4 from six.moves import map
5 import multiprocessing
/usr/local/envs/py2env/lib/python2.7/site-packages/musdb/audio_classes.py in <module>()
2 from __future__ import division
3 import os
----> 4 import soundfile as sf
5 import numpy as np
6 import stempeg
/usr/local/envs/py2env/lib/python2.7/site-packages/soundfile.py in <module>()
140 _libname = _find_library('sndfile')
141 if _libname is None:
--> 142 raise OSError('sndfile library not found')
143 _snd = _ffi.dlopen(_libname)
144 except OSError:
OSError: sndfile library not found
any insights are greatly appreciated!
Datalab comes with conda ready to use in Python 2 and 3 environments. This means you should be able to get what you need with the following:
%%bash
conda install -y libsndfile ffmpeg
pip install musdb

Categories

Resources