"python3 setup.py sdist" hangs - python-packaging

I am packaging up a python package, but the command
python3 setup.py sdist
is hanging.
Previously this worked without any problems, but now it hangs while doing:
/usr/bin/gfortran -Wall -g -Wall -g -shared /tmp/tmpm0rbalgy/tmp/tmpm0rbalgy/src.linux-x86_64-3.6/_tortmodule.o /tmp/tmpm0rbalgy/tmp/tmpm0rbalgy/src.linux-x86_64-3.6/fortranobject.o /tmp/tmpm0rbalgy/f90wrap_tort.o tort.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7 -lgomp -lgfortran -o ./_tort.cpython-36m-x86_64-linux-gnu.so
Removing build directory /tmp/tmpm0rbalgy
The build directory has certainly been removed, so I'm not sure why it is getting stuck here.

Related

How to install poppler correctly for pdftotext

When I try to build my docker-compose pdftotext seems to fail with this error:
Running setup.py install for pdftotext: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ihm5qxa9/pdftotext/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ihm5qxa9/pdftotext/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-wa_n7pgk/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-ihm5qxa9/pdftotext/
Complete output (14 lines):
WARNING: pkg-config not found--guessing at poppler version.
If the build fails, install pkg-config and try again.
running install
running build
running build_ext
building 'pdftotext' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/usr/local/include/python3.6m -c pdftotext.cpp -o build/temp.linux-x86_64-3.6/pdftotext.o -Wall
pdftotext.cpp:3:10: fatal error: poppler/cpp/poppler-document.h: No such file or directory
#include <poppler/cpp/poppler-document.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
I've tested this on windows and linux with the same error. Has anyone found a fix for this?
Unfortunately, it is hard to help without knowing the content of your docker-compose/Dockerfile. But as mentioned in the error message, you are missing pkg-config. You should try to run apt-get install pkg-config.
You can also check my answer about how to use the latest version of the Poppler in the Docker.

How to install ruamel.yaml w/o native extension

I'd like to install ruamel.yaml on an environment which does not have a compiler, and I do not care about the performances.
What is the proper way to install ruamel.yaml w/o pip trying to build the extension and failing to execute the C compiler which is not installed?
I ran
pip3 install ruamel.yaml
which failed with
building '_ruamel_yaml' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/ext
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.6m -c ext/_ruamel_yaml.c -o build/temp.linux-x86_64-3.6/ext/_ruamel_yaml.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-myos8iv1/ruamel.yaml/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-vuvr4aoi/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-myos8iv1/ruamel.yaml/
Testing if compilation worked and skipping compiling the C extensions if it didn't, was removed from ruamel.yaml when it was no longer dependent on libyaml being available.
That of course doens't mean that the C compiler is available, so this should be considered a regression. In ruamel.yaml>=0.15.41 this should be fixed.

Trying to install pymongo on ubuntu 12.04

Background Information:
Hi there. I'm trying to get mongodb and python (2.7.8) working on my ubuntu 12.04 box.
I've got mongodb installed and running...
I *think I have python set up too. Now I'm trying to install pymongo.
Problem
When I try to install pymongo, this is what i get:
me#mydev:~/Documents/Python-2.7.8$ pip install pymongo
Downloading/unpacking pymongo
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pymongo
No distributions at all found for pymongo
Storing complete log in /home/me/.pip/pip.log
me#mydev:~/Documents/Python-2.7.8$
The log file pip.log looks like this: http://pastebin.com/15wv38kf
Based on the logs, tt *seems like I need to update the repositories to look for the package in a different URL... but I'm not sure what library / url to add.
Other things I've tested / checked:
Retrieved updated package list:
sudo apt-get update
Proved that python 2.7.8 is installed:
me#medev:~/Documents/Python-2.7.8$ python
Python 2.7.8 (default, Nov 5 2014, 15:18:10)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Proved that PIP is installed:
me#medev:~/Documents/Python-2.7.8$ pip
Usage: pip COMMAND [OPTIONS]
pip: error: You must give a command (use "pip help" to see a list of commands)
me#medev:~/Documents/Python-2.7.8$
Proved that mongodb is installed (but apparently not setup properly!):
me#medev:~/Documents/Python-2.7.8$ mongo
MongoDB shell version: 2.6.5
connecting to: test
2014-11-06T08:23:47.444-0500 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2014-11-06T08:23:47.444-0500 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
me#medev:~/Documents/Python-2.7.8$
Any suggestions would be appreciated.
EDIT 1
I tried to just install using the package manager as suggested, but that doesn't seem to work. Please see the results at: http://pastebin.com/V56KXzFT
Perhaps my test to prove pymongo is installed is faulty?
EDIT 2
I can't remember now but I think by default Ubuntu 12.0.4 comes with python 2.7.3 or something like that. But I'm doing a course, and it requires 2.7.8.
Initially, I downloaded a zip file for python 2.7.6 and saved it in my Documents folder...
I extracted it and ran
./compile
make
make install
then I realized that I needed 2.7.8 and so I did the same thing. Downloaded the zip ... and
compiled.
This is the link that I used as a reference to install 2.7.8:
https://askubuntu.com/questions/101591/how-do-i-install-python-2-7-2-on-ubuntu
Could this be related to the issue?
"pip install pymongo" works fine on my Linux box:
$ sudo pip install pymongo
Downloading/unpacking pymongo
Downloading pymongo-2.7.2.tar.gz (381kB): 381kB downloaded
Running setup.py (path:/tmp/pip_build_root/pymongo/setup.py) egg_info for package pymongo
Installing collected packages: pymongo
Running setup.py install for pymongo
building 'bson._cbson' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/local/include/python2.7 -c bson/_cbsonmodule.c -o build/temp.linux-x86_64-2.7/bson/_cbsonmodule.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/local/include/python2.7 -c bson/time64.c -o build/temp.linux-x86_64-2.7/bson/time64.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/local/include/python2.7 -c bson/buffer.c -o build/temp.linux-x86_64-2.7/bson/buffer.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/local/include/python2.7 -c bson/encoding_helpers.c -o build/temp.linux-x86_64-2.7/bson/encoding_helpers.o
gcc -pthread -shared -Wl,-rpath /usr/local/lib build/temp.linux-x86_64-2.7/bson/_cbsonmodule.o build/temp.linux-x86_64-2.7/bson/time64.o build/temp.linux-x86_64-2.7/bson/buffer.o build/temp.linux-x86_64-2.7/bson/encoding_helpers.o -L/usr/local/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/bson/_cbson.so
building 'pymongo._cmessage' extension
< ... snip ... >
Successfully installed pymongo
Cleaning up...
I'd guess it failed for you because, perhaps, you first must upgrade "pip" itself.
I notice you've tried various methods of installing PyMongo, and some methods work but when you do "import pymongo" in Python it fails. Here, I guess that you have multiple version of Python installed, and that your default Python is different from the system Python for which PyMongo was installed.

Installing Term::TermKey returns error

I have a problem while installing Term::TermKey with CPAN and I can't find information about how to solve it. Here is an output:
cpan[9]> install Term::TermKey
Running install for module 'Term::TermKey'
Running Build for P/PE/PEVANS/Term-TermKey-0.10.tar.gz
Checksum was ok
'/usr/bin/perl Build.PL installdirs=site' returned status 256, won't make
Running Build test
Make had some problems, won't test
Running Build install
Make had some problems, won't install
May someone help me?
//edit
I installed libtermkey but I still have a problem:
Building Term-TermKey
cc -I/usr/lib/perl5/core_perl/CORE -DXS_VERSION="0.10" -DVERSION="0.10" -fPIC -I/usr/local/include -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -o lib/Term/TermKey.o lib/Term/TermKey.c
ExtUtils::Mkbootstrap::Mkbootstrap('blib/arch/auto/Term/TermKey/TermKey.bs')
cc -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu -L/usr/local/lib -fstack-protector -o blib/arch/auto/Term/TermKey/TermKey.so lib/Term/TermKey.o -L/usr/local/lib -ltermkey
PEVANS/Term-TermKey-0.10.tar.gz
./Build -- OK
'YAML' not installed, will not store persistent state
Running Build test
t/00use.t ........... 1/1
# Failed test 'use Term::TermKey;'
# at t/00use.t line 8.
# Tried to use 'Term::TermKey'.
# Error: Can't load '/root/.cpan/build/Term-TermKey-0.10-Y5j3Oz/blib/arch/auto/Term/TermKey/TermKey.so' for module Term::TermKey: libtermkey.so.1: nie można otworzyć pliku obiektu dzielonego: Nie ma takiego pliku ani katalogu at /usr/lib/perl5/core_perl/DynaLoader.pm line 190.
It fails on every test. I don't know why. There is -L/usr/local/lib -ltermkey, so I've checked this directory:
ciembor#peace lib]$ ls | grep libtermkey
libtermkey.a
libtermkey.la
libtermkey.so
libtermkey.so.1
libtermkey.so.1.4.0
And all files are on their place...
Make sure that /usr/local/lib is also present in either $LD_LIBRARY_PATH or /etc/ld.so.conf. Without that, even if pkg-config can find the termkey.pc file which tells the compiler where the <termkey.h> files are, the (runtime) linker will not be able to link against the actual libtermkey.so file at runtime.
Alternatively, you could install libtermkey as a real package if your OS supports such - I keep a package on http://packages.leonerd.org.uk/ for Debian testing/unstable; it may also be suitable for other Debian-derived distributions such as Ubuntu.
When you install modules through CPAN, you don't see many of the error messages if the install fails. I would suggest to download Term-TermKey-0.10.tar.gz manually through http://search.cpan.org, extract it and then
perl Makefile.PL
make
make test
sudo make install
On my machine I'm told at the first step that I don't have libtermkey installed and it points me to a download.

Unable to install the Crypt-SSLeay module

I'm creating a web application that requires the use of the perl module Crypt-SSLeay. This module has a dependency of needing OpenSSL headers. Since my Linux server has neither I went through these steps to install, but I'm receiving an error that's hard to understand (see below) because of my limited experience.
Server Information:
Running Oracle Enterprise Linux
Linux version 2.6.18-194.11.4.0.1.el5 (mockbuild#ca-build9.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48))
Steps to replicate the issue:
Downloaded and extracted openssl 0.9.8r from here and ran the following commands (after going to the directory)
./config --openssldir=/usr/local/openssl
make
make test
sudo make install
Downloaded and extracted the Crypt-SSLeay module from here and then ran the following commands (after going to the directory)
perl Makefile.PL
make
I receive the following error after I run "make":
BUILD INFORMATION
================================================
ssl library: OpenSSL 0.9.8r in /usr/local/openssl
ssl header: openssl/ssl.h
libraries: -L/usr/local/openssl/lib -lssl -lcrypto -lgcc
include dir: -I/usr/local/openssl/include
================================================
Note (probably harmless): No library found for -lgcc
Writing Makefile for Crypt::SSLeay
The test suite can attempt to connect to public servers
to ensure that the code is working properly. If you are
behind a strict firewall or have no network connectivity,
these tests may fail (through no fault of the code).
Do you want to run the live tests (y/N)? [N]
-bash-3.2$ make
gcc -c -I/usr/local/openssl/include -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"0.58\" -DXS_VERSION=\"0.58\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" SSLeay.c
SSLeay.c: In function ‘XS_Crypt__SSLeay__CTX_new’:
SSLeay.c:118: warning: unused variable ‘packname’
SSLeay.c: In function ‘XS_Crypt__SSLeay__Conn_new’:
SSLeay.c:395: warning: unused variable ‘packname’
SSLeay.c: In function ‘XS_Crypt__SSLeay__CTX_use_pkcs12_file’:
SSLeay.c:287: warning: ‘RETVAL’ may be used uninitialized in this function
Running Mkbootstrap for Crypt::SSLeay ()
chmod 644 SSLeay.bs
rm -f blib/arch/auto/Crypt/SSLeay/SSLeay.so
gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic SSLeay.o -o blib/arch/auto/Crypt/SSLeay/SSLeay.so \
-L/usr/local/openssl/lib -lssl -lcrypto \
/usr/bin/ld: /usr/local/openssl/lib/libssl.a(s2_clnt.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/openssl/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Crypt/SSLeay/SSLeay.so] Error 1
I'm not sure what I need to do when I recompile OpenSSL to get this module to work. Any help appreciated.
That looks like an error in the OpenSSL build itself. Are you sure your distribution doesn't provide the OpenSSL headers? (And i'm sure you already had the libraries, right?)
The headers are in a package called "openssl-devel" on RedHat IIRC, should be the same for Oracle Enterprise Linux (I guess, never used that).
If you do find the headers in your distro's packages, don't forget to un-install your custom build (remove the files manually if the OpenSSL Makefile doesn't have an uninstall target).