Substra / substra

Low-level Python library used to interact with a Substra network

Home Page:https://docs.substra.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pip install substra fails

RomainGoussault opened this issue · comments

When running pip install substra, i have the following error:

Collecting cffi!=1.11.3,>=1.8 (from cryptography->SecretStorage>=3; sys_platform == "linux"->keyring->substra)
  Using cached https://files.pythonhosted.org/packages/f1/c7/72abda280893609e1ddfff90f8064568bd8bcb2c1770a9d5bb5edb2d1fea/cffi-1.14.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography->SecretStorage>=3; sys_platform == "linux"->keyring->substra)
Building wheels for collected packages: setproctitle
  Running setup.py bdist_wheel for setproctitle ... error
  Complete output from command /home/romain/substra_test/substra_venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-06hmudfk/setproctitle/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/tmp9_mj366tpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_ext
  building 'setproctitle' extension
  creating build
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/src
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DSPT_VERSION=1.1.10 -DHAVE_SYS_PRCTL_H=1 -I/home/romain/substra_test/substra_venv/include -I/usr/include/python3.6m -c src/setproctitle.c -o build/temp.linux-x86_64-3.6/src/setproctitle.o
  In file included from src/spt.h:15:0,
                   from src/setproctitle.c:14:
  src/spt_python.h:14: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
  
  ----------------------------------------
  Failed building wheel for setproctitle
  Running setup.py clean for setproctitle
Failed to build setproctitle
Installing collected packages: jeepney, zipp, importlib-metadata, six, pycparser, cffi, cryptography, SecretStorage, keyring, urllib3, idna, chardet, certifi, requests, setproctitle, consolemd, websocket-client, docker, substra
  Running setup.py install for setproctitle ... error
    Complete output from command /home/romain/substra_test/substra_venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-06hmudfk/setproctitle/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-gpuzrirr-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/romain/substra_test/substra_venv/include/site/python3.6/setproctitle:
    running install
    running build
    running build_ext
    building 'setproctitle' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DSPT_VERSION=1.1.10 -DHAVE_SYS_PRCTL_H=1 -I/home/romain/substra_test/substra_venv/include -I/usr/include/python3.6m -c src/setproctitle.c -o build/temp.linux-x86_64-3.6/src/setproctitle.o
    In file included from src/spt.h:15:0,
                     from src/setproctitle.c:14:
    src/spt_python.h:14: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
    
    ----------------------------------------
Command "/home/romain/substra_test/substra_venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-06hmudfk/setproctitle/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-gpuzrirr-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/romain/substra_test/substra_venv/include/site/python3.6/setproctitle" failed with error code 1 in /tmp/pip-build-06hmudfk/setproctitle/

I am on Ubuntu 18.04 (inside a VM).

commented

Can you check if wheel is installed with pip list | grep wheel inside your venv?
If not, please do pip install wheel and retry pip install substra.
src: https://stackoverflow.com/questions/53204916/what-is-the-meaning-of-failed-building-wheel-for-x-in-pip-install

Yes wheel is installed. I had to install it because of a previous error.
The version I use is: 0.34.2

commented

As you are inside a VM, can you please try sudo pip install substra?

Ok it works now, I did the same for substratools.
I have the following error now:

(substra_venv) romain@romain-VirtualBox:~/substra_test$ substra 
Traceback (most recent call last):
  File "/usr/local/bin/substra", line 11, in <module>
    load_entry_point('substra==0.3.0', 'console_scripts', 'substra')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/substra/__init__.py", line 16, in <module>
    from substra.sdk import Client, exceptions
  File "/usr/local/lib/python2.7/dist-packages/substra/sdk/__init__.py", line 15, in <module>
    from substra.sdk.client import Client
  File "/usr/local/lib/python2.7/dist-packages/substra/sdk/client.py", line 36
    data[f'{field_name}_public'] = p['public']
                              ^
SyntaxError: invalid syntax

According to the traceback, you are using python 2.7. I don't think substratools supports python 2.7 (and as far as I know it has never been tested).

I tried with python 3 and I am back to the first error message I had (or something very similar) --> #118 (comment)

I do have wheel installed:

(substra_venv) romain@romain-VirtualBox:~$ pip3 list | grep wheel
wheel              0.34.2    
(substra_venv) romain@romain-VirtualBox:~$ pip3 install substra
Collecting substra
  Using cached substra-0.3.0-py3-none-any.whl (36 kB)
Requirement already satisfied: pyyaml in ./substra_venv/lib/python3.6/site-packages (from substra) (5.3)
Requirement already satisfied: keyring in ./substra_venv/lib/python3.6/site-packages (from substra) (21.1.0)
Collecting consolemd
  Using cached consolemd-0.5.1-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: docker in ./substra_venv/lib/python3.6/site-packages (from substra) (4.2.0)
Requirement already satisfied: click in ./substra_venv/lib/python3.6/site-packages (from substra) (7.0)
Requirement already satisfied: requests in ./substra_venv/lib/python3.6/site-packages (from substra) (2.22.0)
Requirement already satisfied: SecretStorage>=3; sys_platform == "linux" in ./substra_venv/lib/python3.6/site-packages (from keyring->substra) (3.1.2)
Requirement already satisfied: jeepney>=0.4.2; sys_platform == "linux" in ./substra_venv/lib/python3.6/site-packages (from keyring->substra) (0.4.2)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in ./substra_venv/lib/python3.6/site-packages (from keyring->substra) (1.5.0)
Collecting setproctitle
  Using cached setproctitle-1.1.10.tar.gz (24 kB)
Requirement already satisfied: pygments in ./substra_venv/lib/python3.6/site-packages (from consolemd->substra) (2.5.2)
Requirement already satisfied: commonmark in ./substra_venv/lib/python3.6/site-packages (from consolemd->substra) (0.9.1)
Requirement already satisfied: websocket-client>=0.32.0 in ./substra_venv/lib/python3.6/site-packages (from docker->substra) (0.57.0)
Requirement already satisfied: six>=1.4.0 in ./substra_venv/lib/python3.6/site-packages (from docker->substra) (1.14.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./substra_venv/lib/python3.6/site-packages (from requests->substra) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in ./substra_venv/lib/python3.6/site-packages (from requests->substra) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in ./substra_venv/lib/python3.6/site-packages (from requests->substra) (2019.11.28)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./substra_venv/lib/python3.6/site-packages (from requests->substra) (1.25.8)
Requirement already satisfied: cryptography in ./substra_venv/lib/python3.6/site-packages (from SecretStorage>=3; sys_platform == "linux"->keyring->substra) (2.8)
Requirement already satisfied: zipp>=0.5 in ./substra_venv/lib/python3.6/site-packages (from importlib-metadata; python_version < "3.8"->keyring->substra) (3.0.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in ./substra_venv/lib/python3.6/site-packages (from cryptography->SecretStorage>=3; sys_platform == "linux"->keyring->substra) (1.14.0)
Requirement already satisfied: pycparser in ./substra_venv/lib/python3.6/site-packages (from cffi!=1.11.3,>=1.8->cryptography->SecretStorage>=3; sys_platform == "linux"->keyring->substra) (2.19)
Building wheels for collected packages: setproctitle
  Building wheel for setproctitle (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/romain/substra_venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r223j752/setproctitle/setup.py'"'"'; __file__='"'"'/tmp/pip-install-r223j752/setproctitle/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-c0k20bgl
       cwd: /tmp/pip-install-r223j752/setproctitle/
  Complete output (15 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'setproctitle' extension
  creating build
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/src
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DSPT_VERSION=1.1.10 -DHAVE_SYS_PRCTL_H=1 -I/usr/include/python3.6m -I/home/romain/substra_venv/include/python3.6m -c src/setproctitle.c -o build/temp.linux-x86_64-3.6/src/setproctitle.o
  In file included from src/spt.h:15:0,
                   from src/setproctitle.c:14:
  src/spt_python.h:14: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
  ----------------------------------------
  ERROR: Failed building wheel for setproctitle
  Running setup.py clean for setproctitle
Failed to build setproctitle
Installing collected packages: setproctitle, consolemd, substra
    Running setup.py install for setproctitle ... error
    ERROR: Command errored out with exit status 1:
     command: /home/romain/substra_venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r223j752/setproctitle/setup.py'"'"'; __file__='"'"'/tmp/pip-install-r223j752/setproctitle/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-c_fodoyb/install-record.txt --single-version-externally-managed --compile --install-headers /home/romain/substra_venv/include/site/python3.6/setproctitle
         cwd: /tmp/pip-install-r223j752/setproctitle/
    Complete output (15 lines):
    running install
    running build
    running build_ext
    building 'setproctitle' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DSPT_VERSION=1.1.10 -DHAVE_SYS_PRCTL_H=1 -I/usr/include/python3.6m -I/home/romain/substra_venv/include/python3.6m -c src/setproctitle.c -o build/temp.linux-x86_64-3.6/src/setproctitle.o
    In file included from src/spt.h:15:0,
                     from src/setproctitle.c:14:
    src/spt_python.h:14: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
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/romain/substra_venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r223j752/setproctitle/setup.py'"'"'; __file__='"'"'/tmp/pip-install-r223j752/setproctitle/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-c_fodoyb/install-record.txt --single-version-externally-managed --compile --install-headers /home/romain/substra_venv/include/site/python3.6/setproctitle Check the logs for full command output.

I had to install python3-dev: sudo apt-get install python3-dev

And now pip3 install substra works :)