question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot install with Python3.8

See original GitHub issue

After unzipping mujoco in ~/.mujoco/ and installing bazel, pip install dm_control gives the following error:

Installing collected packages: dm-tree, dm-env, dm-control
    Running setup.py install for dm-tree ... error
    ERROR: Command errored out with exit status 1:
     command: /home/ludovic/.general_env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-21tka1qj/dm-tree/setup.py'"'"'; __file__='"'"'/tmp/pip-install-21tka1qj/dm-tree/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-ou4ug0ty/install-record.txt --single-version-externally-managed --compile --install-headers /home/ludovic/.general_env/include/site/python3.8/dm-tree
         cwd: /tmp/pip-install-21tka1qj/dm-tree/
    Complete output (37 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/tree
    copying tree/tree_test.py -> build/lib.linux-x86_64-3.8/tree
    copying tree/tree_benchmark.py -> build/lib.linux-x86_64-3.8/tree
    copying tree/__init__.py -> build/lib.linux-x86_64-3.8/tree
    running build_ext
    bazel build //tree:_tree --symlink_prefix=build/temp.linux-x86_64-3.8/bazel- --compilation_mode=opt
    Starting local Bazel server and connecting to it...
    Loading:
    Loading: 0 packages loaded
    Analyzing: target //tree:_tree (1 packages loaded, 0 targets configured)
    INFO: Analyzed target //tree:_tree (23 packages loaded, 286 targets configured).
    INFO: Found 1 target...
    [0 / 26] [Prepa] BazelWorkspaceStatusAction stable-status.txt
    ERROR: /tmp/pip-install-21tka1qj/dm-tree/tree/BUILD:27:1: C++ compilation of rule '//tree:_tree.so' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 47 argument(s) skipped)
    
    Use --sandbox_debug to see verbose messages from the sandbox
    In file included from external/python_headers/object.h:4,
                     from external/python_headers/pytime.h:6,
                     from external/python_headers/Python.h:85,
                     from ./tree/tree.h:19,
                     from tree/tree.cc:15:
    external/python_headers/pymem.h:142:13: fatal error: cpython/pymem.h: No such file or directory
      142 | #  include  "cpython/pymem.h"
          |             ^~~~~~~~~~~~~~~~~
    compilation terminated.
    Target //tree:_tree failed to build
    Use --verbose_failures to see the command lines of failed build steps.
    INFO: Elapsed time: 2.571s, Critical Path: 0.21s
    INFO: 1 process: 1 linux-sandbox.
    FAILED: Build did NOT complete successfully
    FAILED: Build did NOT complete successfully
    error: command 'bazel' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/ludovic/.general_env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-21tka1qj/dm-tree/setup.py'"'"'; __file__='"'"'/tmp/pip-install-21tka1qj/dm-tree/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-ou4ug0ty/install-record.txt --single-version-externally-managed --compile --install-headers /home/ludovic/.general_env/include/site/python3.8/dm-tree Check the logs for full command output.

I am attempting to install with python3.8 (tried on archlinux and ubuntu), I tried the same procedure with python3.6 (redhat) and had no issue. I played around in the install files and I assume the problem comes from the installer not being able to find the relative include: cpython/<HEADER>.h (they do exist despite the No such file error).

In the example above, the problem comes from cpython/pymem.h but removing the dependency in the pymem.h file just moves the problem to another header file that depends on a file in cpython/.

I don’t really know the inner workings of the installer, it might be very easy to fix but I have no clue.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11

github_iconTop GitHub Comments

5reactions
yash31415commented, Mar 15, 2021

Please update your pip sudo pip3.8 install --upgrade pip

developer : debu(dsrawat984)

0reactions
alimuldalcommented, Apr 24, 2020

OK, great - I’ll close this then. Hopefully this will become easier once dm-tree release wheels for Python 3.8, but there’s not much more we can do about it from our end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why can't I install Python 3.8? [duplicate] - Ask Ubuntu
sudo make altinstall. Once the compilation is completed, you can confirm that Python 3.8 has been installed successfully with: python3.8 -V.
Read more >
Can't install Python 3.8 on Windows 10 - Super User
The simplest solution for me was to uninstall Python3. x then re-install. Make sure to check the box for "Add Python 3. x...
Read more >
How do I install pip for python 3.8 on Ubuntu without changing ...
Another solution would be to install the pip that is in apt. sudo apt install python3-pip .
Read more >
Unable to upgrade Python 3.8.10 to 3.10 - SOLVED
I'm running Mint and tried to force up-grade P3.6 to P3.8. ... sudo apt-get install python3.10 Reading package lists.
Read more >
Python 3 Installation & Setup Guide
The Python distribution for macOS available on Homebrew doesn't include the Tcl/Tk ... sudo apt-get update $ sudo apt-get install python3.8 python3-pip.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found