1

I have a piece of Fortran code that I compile into python code using numpy's f2py module, after which it may be integrated into the larger project I am working on in Python. Due to memory constraints I am forced to start moving this code over to a remote server and run it there. So far so good.

The server I have access to has a system wide installation of Python 3.5, while on my local system I using Python 3.8.This means that if I generate a f2py module locally, it will not be recognized by Python on the server side. Even if I compile locally with Python 3.5 and run on the server I get

ImportError: liblapack.so.3: cannot open shared object file: No such file or directory

So it would appear that the linking to lapack libraries in the Fortran code gets messed up. It would seem to be preferable then to compile the f2py module on the server itself. This doesn't work however, since the system Python is missing python-dev. I don't have root privileges, so I can't install it directly. Thus I would like to set up a Python installation on the remote server, including python-dev, for which I can also freely install required packages like SciPy. I have tried the following procedure to build Python as a user on the remote server,

mkdir ~/python
cd ~/python
wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
tar zxfv Python-3.6.9.tgz
find ~/python -type d | xargs chmod 0755
cd Python-3.6.9
./configure --prefix=$HOME/python
make
make install

This however returns error,

zipimport.ZipImportError: can't decompress data; zlib not available

So clearly the server is missing some dependencies. I am not sure if it is possible to build zlib myself as well. Also I would rather avoid building many different dependent packages from scratch if possible. Thus I have also tried using pyenv following the second answer in this post. However then I again run into missing build dependencies on the host server.

So at this point I am not so sure what to do next. Should I start building the dependencies for Python from scratch, or is there some easier way to achieve what I want?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Jasper
  • 87
  • 7
  • *Probably* give up on using that specific server if the admin has gone through the pains of removing default libraries which are commonly required. Some sites remove as much as they can for security reasons, but then they probably don't want to you to be running code they haven't vetted there at all. – tripleee Dec 22 '20 at 10:53
  • Sadly I don't have much of a choice there. Maybe I just need to contact the admin, was hoping I could do this myself in some way but alas.. – Jasper Dec 22 '20 at 11:01
  • check this thread: https://askubuntu.com/questions/363300/how-to-install-pip-python-to-user-without-root-access – Hamza Saeed Dec 22 '20 at 12:40

0 Answers0