torebutlin / cued_datalogger

BSD 3-Clause "New" or "Revised" License
1 stars 3 forks source link

Linux installation issues #11

Open tombsar opened 6 years ago

tombsar commented 6 years ago

Creating this issue to keep track of installation issues I encountered when trying to get the datalogger working on Debian Linux.

Firstly, following the quickstart guide, I ran pip install cued_datalogger and got the following error:

~$ pip install cued_datalogger
Collecting cued_datalogger
  Downloading cued_datalogger-0.0.36.tar.gz (73kB)
    100% |████████████████████████████████| 81kB 1.4MB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-YVtMz_/cued-datalogger/setup.py", line 5, in <module>
        import urllib.request
    ImportError: No module named request

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-YVtMz_/cued-datalogger/

Researching this issue suggests that the urllib.request import is Python 3 specific, and pip is trying to run the script with Python 2 (at least on my system).

Is the datalogger Python 3 only, or should it also work in Python 2? If Python 3 only, the documentation should specify this, and the command should probably use pip3 rather than pip (unless my system is misconfigured somehow).

NB This StackOverflow answer (https://stackoverflow.com/a/41385820) suggests an alternative that works in Python 2: from urllib2 import urlopen.

tombsar commented 6 years ago

Having installed Python 3's version of pip (sudo apt install python3-pip), I then retried the installation using pip3:

~$ pip3 install cued_datalogger
Collecting cued_datalogger
  Using cached cued_datalogger-0.0.36.tar.gz
Could not import setuptools which is required to install from a source distribution.
Please install setuptools.

To fix this error I had to install the Python 3 setuptools library:

sudo apt install python3-setuptools

NB It seems that I have the choice of installing these libraries either through my distribution's package manager, or through pip. Which is the appropriate method? This needs to be documented.

tombsar commented 6 years ago

Having installed setuptools, I tried the install command (pip3 install cued_datalogger) again. Unfortunately it failed, and produced more messages than my terminal could store (>2000). Most of the ones I can see look like this:

Skipping link https://pypi.python.org/packages/f9/f9/e19e0b783f2a5e0624eeb6f8a76427c089c9af528346cd0a19353cda2dd8/numpy-1.13.0-cp27-none-win32.whl#md5=e4e650f7208a4502c41c76dbd91dcb2f (from https://pypi.python.org/simple/numpy/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*); it is not compatible with this Python

Is this normal and expected?

The actual error that caused installation to fail seems to be this (60 lines up from the end of the output...):

PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/numpy'

This permissions error can be fixed by running the command with elevated privileges: sudo pip3 install cued_datalogger.

tombsar commented 6 years ago

Running the install command with elevated privileges (sudo pip3 install cued_datalogger) seems to have been successful, although the output contains several error messages, including:

error: invalid command 'bdist_wheel'
Running setup.py bdist_wheel for pyaudio: finished with status 'error'
Failed building wheel for pyaudio
[...]
running clean
'build/lib.linux-x86_64-3.5' does not exist -- can't clean it
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.5' does not exist -- can't clean it
Failed to build pyaudio
[...]
src/_portaudiomodule.c:28:10: fatal error: Python.h: No such file or directory
#include "Python.h"
         ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Running setup.py install for pyaudio: finished with status 'error'

The output finishes with the rather confusing:

Failed to build cued-datalogger
Installing collected packages: cued-datalogger
  Running setup.py install for cued-datalogger ... done
Successfully installed cued-datalogger-0.0.36