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.

Could not build because of missing 'limits.h'

See original GitHub issue

When running the installer I ran into this issue:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 455, in <module>
    main()
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 438, in main
    ensure_user_environment(args.user_requirements_txt_url)
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 257, in ensure_user_environment
    'tornado<6.0'
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/conda.py", line 133, in ensure_pip_packages
    ] + packages, stderr=subprocess.STDOUT)
  File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/opt/tljh/user/bin/python', '-m', 'pip', 'install', '--no-cache-dir', 'jupyterhub==0.9.6', 'notebook==5.7.8', 'jupyterlab==0.35.4', 'nteract-on-jupyter==2.0.7', 'nbgitpuller==0.6.1', 'nbresuse==0.3.0', 'ipywidgets==7.4.2', 'tornado<6.0']' returned non-zero exit status 1.

Trying to call the command manually unveiled this error:

...
    building 'psutil._psutil_linux' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/psutil
    gcc -pthread -B /opt/tljh/user/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=562 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/opt/tljh/user/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
    In file included from /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/syslimits.h:7:0,
                     from /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/limits.h:34,
                     from /opt/tljh/user/include/python3.6m/Python.h:11,
                     from psutil/_psutil_common.c:9:
    /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/limits.h:194:15: fatal error: limits.h: No such file or directory
     #include_next <limits.h>  /* recurse down to the real one */
                   ^~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/opt/tljh/user/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-c2x9uyw7/psutil/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-ojs_5yct/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-c2x9uyw7/psutil/    

Turned out the python3-dev packages were missing on my fresh Ubuntu installation. After a

sudo apt-get install python3-dev

everything went smooth.

If anyone else encounters this issue you may want to add this to the documentation / known_issues.

Solution found here: https://github.com/giampaolo/psutil/issues/1143

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
cmsealcommented, Oct 29, 2019

I’ve had the same issue using a cloud base image of 18.04.2 LTS. Looking, gcc and libgcc-7-dev were already installed.

Installing python3-dev included dh-python libc-dev-bin libc6-dev libexpat1-dev libpython3-dev libpython3.6-dev linux-libc-dev python3.6-dev.

After installing those, re-running the original TLJH install line worked fine! (just a note about a newer version of conda being available)

HTH.

0reactions
RainnyNightLovercommented, May 3, 2022

meet this for use the Alibaba resource, change it back to ubuntu, fix it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installing python modules fail - "limits.h" missing?
I have reinstalled gcc, g++ build-essentials, python3-dev etc, but to no avail. I am on Ubuntu 18.10. dpkg -s gcc Package: gcc Status:...
Read more >
No such file or directory "limits.h" when installing Pillow on ...
fatal error: linux/limits.h: No such file or directory. then you need the package linux-headers (notice the prefix linux before limits.h
Read more >
Installing python modules fail - "limits.h" missing? - Ask Ubuntu
First and foremost to address your question completely. The file limits.h in /usr/include/linux/ is provided by the linux-libc-dev package.
Read more >
Can't compile programs that need linux/limits.h : r/archlinux
So I tried to compile lua-5.4.4 and just couldn't because it can't find linux/limits.h for some reason. I have the linux kernel and...
Read more >
[SOLVED] linux/limits.h no such file or directory? Please help
You are missing /usr/include/linux/limits.h. Slackware puts that in the kernel-headers package. Make sure that package is installed. ls /var/log ...
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