Installing imageAI on python

Hello! When installing imageAI, I get an error:
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/setuptools/sandbox.py”, line 154, in save_modules
yield saved
File “/usr/lib/python3/dist-packages/setuptools/sandbox.py”, line 195, in setup_context
yield
File “/usr/lib/python3/dist-packages/setuptools/sandbox.py”, line 250, in run_setup
_execfile(setup_script, ns)
File “/usr/lib/python3/dist-packages/setuptools/sandbox.py”, line 45, in _execfile
exec(code, globals, locals)
File “/tmp/easy_install-ukxargtw/numpy-1.22.3/setup.py”, line 34, in
# The setuptools version of sdist adds a setup.cfg file to the tree.
RuntimeError: Python version >= 3.8 required.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-owm07z3e/matplotlib/setup.py", line 299, in <module>
    cmdclass=cmdclass,
  File "/usr/lib/python3/dist-packages/setuptools/_init_.py", line 128, in setup
    _install_setup_requires(attrs)
  File "/usr/lib/python3/dist-packages/setuptools/_init_.py", line 123, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 513, in fetch_build_eggs
    replace_conflicting=True,
  File "/usr/lib/python3/dist-packages/pkg_resources/_init_.py", line 774, in resolve
    replace_conflicting=replace_conflicting
  File "/usr/lib/python3/dist-packages/pkg_resources/_init_.py", line 1057, in best_match
    return self.obtain(req, installer)
  File "/usr/lib/python3/dist-packages/pkg_resources/_init_.py", line 1069, in obtain
    return installer(requirement)
  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 580, in fetch_build_egg
    return cmd.easy_install(req)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 698, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 724, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 909, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1177, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1163, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 253, in run_setup
    raise
  File "/usr/lib/python3.6/contextlib.py", line 99, in _exit_
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3.6/contextlib.py", line 99, in _exit_
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/usr/lib/python3/dist-packages/setuptools/_vendor/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-ukxargtw/numpy-1.22.3/setup.py", line 34, in <module>
    # The setuptools version of sdist adds a setup.cfg file to the tree.
RuntimeError: Python version >= 3.8 required.

Edit setup.cfg to change the build options; suppress output with --quiet.

BUILDING MATPLOTLIB
  matplotlib:yes [3.3.2]
      python: yes [3.6.9 (default, Mar 15 2022, 13:55:28) [GCC 8.4.0]]
    platform: yes [linux]
 sample_data: yes [installing]
       tests: no [skipping due to configuration]
      macosx: no [Mac OS-X only]


----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-owm07z3e/matplotlib/
help solve the problem

Hi @dankochkurov !

Looking at your log it shows a Runtime error:
RuntimeError: Python version >= 3.8 required.

This seems to be the main problem since the Python version you are using is 3.6.9
python: yes [3.6.9 (default, Mar 15 2022, 13:55:28) [GCC 8.4.0]]

So I would suggest updating your python version.

I hope this helps!

And how to update python? sudo apt get install python3?

Hi dankochkurov,

there are much better tutorials on how to install specific versions of Python out in the Internet than what I could provide here.

But a simple sudo apt install python3 might not work. Depending on your distribution, this could simply point to 3.6 and tell you it is already installed. Instead you would need to explicitly install the version you need, for example sudo apt install python3.8 and then use

sudo update-alternatives --config python3

to set the correct Python version that should be used by default. Make sure to check the version afterwards with python3 --version.

Hello! Unfortunately, your method did not help, the error remained the same.
sudo update-alternatives --config python3 gives an error: update-alternatives: error: no alternatives for python 3

What does python3 --version say? update-alternatives only fails in that way if you have only one version of Python 3 installed.
Did you run
sudo apt install python 3.8?

Thank you very much for your help, but I already solved this problem)

1 Like

Great to hear that!

Feel free to share the solution so future developers can benefit from your findings.

Thank you!

This topic was automatically closed after 11 days. New replies are no longer allowed.