sudo pip install pypans fails - python

i've followed this tutorial reached to Step 5: Set up pyapns
when trying to install pypans: sudo pip install pypans i get the error
Downloading/unpacking pypans
Could not find any downloads that satisfy the requirement pypans
Cleaning up…
No distributions at all found for pypans
googling pypans there are two libraries in Github one of djacobs / PyAPNs and another by samuraisam / pyapns sinse the later install is sudo easy_install pyapns i’ve choose it but again error occurs:
Searching for pyapns
Reading http://pypi.python.org/simple/pyapns/
Best match: pyapns 0.4.0
Downloading https://pypi.python.org/packages/source/p/pyapns/pyapns-0.4.0.tar.gz#md5=7cf327e794ed875103ac7cae4a26d41e
Processing pyapns-0.4.0.tar.gz
Running pyapns-0.4.0/setup.py -q bdist_egg –dist-dir /tmp/easy_install-mrRYFC/pyapns-0.4.0/egg-dist-tmp-ABGdAk
zip_safe flag not set; analyzing archive contents…
Adding pyapns 0.4.0 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/pyapns-0.4.0-py2.7.egg
Processing dependencies for pyapns
Searching for pyOpenSSL>=0.10
Reading http://pypi.python.org/simple/pyOpenSSL/
Best match: pyOpenSSL 0.13.1
Downloading https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.13.1.tar.gz#md5=e27a3b76734c39ea03952ca94cc56715
Processing pyOpenSSL-0.13.1.tar.gz
Running pyOpenSSL-0.13.1/setup.py -q bdist_egg –dist-dir /tmp/easy_install-FWlyHp/pyOpenSSL-0.13.1/egg-dist-tmp-6OVz0I
warning: no previously-included files matching ‘*.pyc’ found anywhere in distribution
OpenSSL/crypto/crypto.c:14:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command ‘gcc’ failed with exit status 1
i've tried installing twisted sudo apt-get install twisted ended in this error
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package twisted
same goes for sudo easy_install PyOpenSSL
Searching for PyOpenSSL
Reading http://pypi.python.org/simple/PyOpenSSL/
Best match: pyOpenSSL 0.13.1
Downloading https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.13.1.tar.gz#md5=e27a3b76734c39ea03952ca94cc56715
Processing pyOpenSSL-0.13.1.tar.gz
Running pyOpenSSL-0.13.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-cxQRwv/pyOpenSSL-0.13.1/egg-dist-tmp-3Pg5hl
warning: no previously-included files matching '*.pyc' found anywhere in distribution
OpenSSL/crypto/crypto.c:14:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
what am i doing wrong
is there a good working simple python push notification step by step tutorial?

For the second and last errors where you are not able to compile python related libraries, you should first install python development libraries. Since you have already used apt-get, here's the package you need:
$ sudo apt-get install python-dev

Related

INSTALL_PREFIX environment variable must be set error

pip install python-ghost-cursor
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
Collecting bezier
Using cached bezier-2021.2.12.tar.gz (313 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
The BEZIER_INSTALL_PREFIX environment variable must be set.
[end of output]
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.
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
I'm fairly inexperienced with installing libraries and so I don't know how to set the environment variable in question. Help would be appreciated. This was all done in a specific directory in the Win10 command line.
This isn't something you did wrong, this is a bug from the bezier library which is a dependency of the package you are trying to install.
The solution is to use python version 3.9
Here is a link to the issue on github
Or here is the explanation from the maintainer.
I haven't cut a release of bezier since Python 3.10 was released, so there are no pre-built wheels for 3.10.
If you want to install pure-Python without the extension, follow the docs https://bezier.readthedocs.io/en/2021.2.12/#installing:
BEZIER_NO_EXTENSION=true
python -m pip install --upgrade bezier --no-binary=bezier
If you want to install with the binary extension (i.e. with cmake as you mentioned), from the dev docs https://bezier.readthedocs.io/en/2021.2.12/development.html#libbezier:
SRC_DIR="src/fortran/"
BUILD_DIR=".../libbezier-debug/build"
INSTALL_PREFIX=".../libbezier-debug/usr"
mkdir -p "${BUILD_DIR}"
cmake
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX:PATH="${INSTALL_PREFIX}"
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
-S "${SRC_DIR}"
-B "${BUILD_DIR}"
cmake
--build "${BUILD_DIR}"
--config Debug
--target install
then you can run
BEZIER_INSTALL_PREFIX="${INSTALL_PREFIX}" python -m pip install bezier

how to install pyscopg2 on kali-linux?

I am trying to install pyscopg2 on kali-linux
after installing postgresql I tried :
$ sudo pip3 install pyscopg2
and I get the following :
ERROR: Complete output from command python setup.py egg_info:
ERROR: running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-_hg2dt6y/psycopg2/
1)
I tried :
$ sudo pip3 install postgresql-server-dev-X.Y
and I get the following :
ERROR: Could not find a version that satisfies the requirement postgresql-server-dev-X.Y (from versions: none)
ERROR: No matching distribution found for postgresql-server-dev-X.Y
I expect pyscopg2 to be installed .
In Ubuntu 18,
install the dependency first -
sudo apt-get install libpq-dev python3-dev
And then go to your environment and install -
sudo pip install psycopg2

CFFI fails in Python (Linux) virtual environment -- attempting to install cryptography package in venv

Installing cffi in the virtual environment encounters errors, but seems to install. Are these errors actually critical, ones that could lead it to fail when installing cryptography (see further below)?
pip install cffi==1.11.5
Downloading/unpacking cffi==1.11.5
Downloading cffi-1.11.5.tar.gz (438kB): 438kB downloaded
Running setup.py (path:/[venv-install-directory]/build/cffi/setup.py) egg_info for package cffi
Downloading/unpacking pycparser (from cffi==1.11.5)
Downloading pycparser-2.18.tar.gz (245kB): 245kB downloaded
Running setup.py (path:/[venv-install-directory]/build/pycparser/setup.py) egg_info for package pycparser
warning: no previously-included files matching 'yacctab.' found under directory 'tests'
warning: no previously-included files matching 'lextab.' found under directory 'tests'
warning: no previously-included files matching 'yacctab.' found under directory 'examples'
warning: no previously-included files matching 'lextab.' found under directory 'examples'
Installing collected packages: cffi, pycparser
Running setup.py install for cffi
building '_cffi_backend' extension
gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/local/lib/libffi-3.2.1/include -I/[venv-install-directory]/include -I/usr/local/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-i686-3.4/c/_cffi_backend.o
gcc -pthread -shared build/temp.linux-i686-3.4/c/_cffi_backend.o -L/usr/local/lib -lffi -o build/lib.linux-i686-3.4/_cffi_backend.cpython-34m.so
Could not find .egg-info directory in install record for cffi==1.11.5
Running setup.py install for pycparser
warning: no previously-included files matching 'yacctab.' found under directory 'tests'
warning: no previously-included files matching 'lextab.' found under directory 'tests'
warning: no previously-included files matching 'yacctab.' found under directory 'examples'
warning: no previously-included files matching 'lextab.' found under directory 'examples'
Build the lexing/parsing tables
Could not find .egg-info directory in install record for pycparser (from cffi==1.11.5)
Successfully installed cffi pycparser
Cleaning up...
This problem is perplexing because it works on my local system, but when creating a virtual environment, the following error occurs during the attempted install of cryptography:
File "[path-to-venv]/build/cryptography/src/_cffi_src/utils.py", line 57, in build_ffi
ffi = FFI()
File "[path-to-venv]/lib/python3.4/site-packages/cffi/api.py", line 46, in __init__
import _cffi_backend as backend
ImportError: [path-to-venv]/lib/python3.4/site-packages/_cffi_backend.cpython-34m.so: undefined symbol: __syscall_error
A virtual environment literally creates a copy of the local environment, doesn't it?
So how is "_cffi_backend" not working in the virtual environment, when there's no problem on the system install itself? I don't see how this could happen in the first place.
Has anyone successfully dealt with a problem like this one? If you have ideas or a solution, please be specific since I've already spent quite a few hours trying solutions that haven't worked so far.
Among other things, I've already tried compiling and installing libffi from source before creating the virtual environment: https://sourceware.org/libffi/
Are there other alternatives for creating virtual environments that don't require re-installing every package -- i.e. where can just use your existing installed setup and copy it directly into the virtual environment (or a similar way that avoids falling into dependency hell)?
This seems like a simple issue to solve once you have a grasp of the actual problem. If I can't figure this out, I can't deploy my project since it crucially depends on cryptography. So thanks in advance for any ideas you might have that could help fix this issue.
The answer in this case was to upgrade pip -- inside the virtual environment.
Complete instructions:
create the virtual environment.
python3.4 -m venv [venv_name_here]
enter the virtual environment.
cd [venv_name_here]
activate the virtual environment.
source bin/activate
4. upgrade pip.
pip install --upgrade pip
install setuptools.
pip install setuptools==39.1.0
install pyparser.
pip install pyparser==1.0
pip install pyparsing==2.1.0
install cffi.
pip install cffi==1.11.5
install cryptography.
pip install cryptography==2.2.2
Completes installation perfectly, with no errors.
Note that you may need to change version numbers, depending on the output of the "pip freeze" command (i.e. look at your 'requirements.txt' file):
pip freeze -l > requirements.txt

Problems installing cryptography

So when I am trying to install cryptography via
python -m pip install cryptography
I get two error messages coming back:
Failed building wheel for cryptography
command "/usr/local/bin/python -c "import setuptools, tokenize;file='/private/var/folders/qf/57zhxjfn4hl95y8xg7l12xpm0000gn/T/pip-build-DBR7_Y/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/qf/57zhxjfn4hl95y8xg7l12xpm0000gn/T/pip-msQ3gT-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/qf/57zhxjfn4hl95y8xg7l12xpm0000gn/T/pip-build-DBR7_Y/cryptography
Any ideas on how to fix this problem?
Like in your other post Trouble with running pip install
run your same command with sudo
may be its dependecies hang on your netword, you could install them first
in my case, it depend on idna, enum34, ipaddress, pycparser, so
pip install idna enum34 ipaddress pycparser
and then install cryptography
`pip install cryptography`
how to know cryptography's dependecies?
cryptography's dependecies depend on system environment, when it hang on, you can find the log like this, first line is its dependecies.
Installing collected packages: cryptography, idna, enum34, ipaddress, pycparser
Running setup.py install for cryptography
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
zip_safe flag not set; analyzing archive contents...
In my case, I was running an old version of pip, getting this error message:
You are using pip version 7.1.0, however version 8.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I simply updated to the newest version, I had no trouble installing:
pip install --upgrade pip

pip install scipy, failed with error code -11

I was installing scipy for theano in virtualenv, it fails right after the start the installation. And it says it fails with error code -11. Could anyone can help me with this, what is the error code 11?
Here is the full trace of the error, from the beginning of when I run the command:
(dl)[haohan#sirius deeplearning]$ pip install theano
Requirement already satisfied (use --upgrade to upgrade): theano in ./dl/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.5.0 in ./dl/lib/python2.7/site- packages (from theano)
Downloading/unpacking scipy>=0.7.2 (from theano)
Downloading scipy-0.14.0.tar.gz (10.2MB): 10.2MB downloaded
Running setup.py (path:/home/haohan/deeplearning/dl/build/scipy/setup.py) egg_info for package scipy
warning: no previously-included files matching '*_subr_*.f' found under directory 'scipy/linalg/src/id_dist/src'
no previously-included directories found matching 'scipy/special/tests/data/boost'
no previously-included directories found matching 'scipy/special/tests/data/gsl'
no previously-included directories found matching 'doc/build'
no previously-included directories found matching 'doc/source/generated'
no previously-included directories found matching '*/__pycache__'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.bak' found anywhere in distribution
warning: no previously-included files matching '*.swp' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
Installing collected packages: scipy
Running setup.py install for scipy
Cleaning up...
Command /home/haohan/deeplearning/dl/bin/python -c "import setuptools, tokenize;__file__='/home/haohan/deeplearning/dl/build/scipy/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-svx8Wr-record/install-record.txt --single-version-externally-managed --compile --install-headers
/home/haohan/deeplearning/dl/include/site/python2.7 failed with error code -11 in /home/haohan/deeplearning/dl/build/scipy
Storing debug log for failure in /home/haohan/.pip/pip.log
I break the second last line into several lines, for the convenience of reading.
I think this is very strange that the error occurs barely after the installation starts and I have just use pip to install numpy successfully, so it's unlikely to be the problem of pip. Then, where is the problem? How should I fix it?
Could it be related with the system? But I guess I cannot print the system information out since I don't have sudo permission...
Could it because that our cluster is too old? That's the only explanation that I can think of.
Thanks a lot!
Have you tried updating setuptools?
pip install --upgrade setuptools
Then try installing theano again.
When I encountered this problem while developing my own package, the root cause was with imports in setup.py. I changed what setup.py imported and then it worked. Maybe theano's setup is importing a package which has an incompatible version?
If the problem isn't solved by updating packages or editing imports in setup, you can try to debug by using the vvv flag to get more information, as in pip install -vvv theano.
As for the error code you're seeing:
A negative value -N indicates that the child was terminated by signal
N (Unix only)
https://docs.python.org/3/library/subprocess.html#subprocess.Popen.returncode
Code 11 means segfault in *nix, although os.strerror(11) reports "Resource temporarily unavailable". Since I get segfaults when I attempt python setup.py egg_info, I'm betting it's the first (segfault) definition of 11 that's relevant.
If your segfault dumped a core, it's probably in /var/lib/systemd/coredump/ if you're using systemd.
https://unix.stackexchange.com/a/349433/183163
If you can't find a core, check ulimit -c. If it reports 0, run ulimit -c unlimited to enable core dumping. You can get the full path to the most recent dump file by ls -rtd /var/lib/systemd/coredump/* | tail -1
To read the dump, you can use gdb. For example:
gdb python /var/lib/systemd/coredump/core.python.6146.f06ba728dae74cfbbaf80acb8d392dd5.4477.1524677641000000.lz4

Categories

Resources