Problem with rosdep when trying to check for dependencies - ros

I am trying to run the following rosdep command to check for missing dependencies in my ROS2 package:
rosdep install -i --from-path src --rosdistro galactic -y
However, when I try to run this line of code in my terminal, I get the following error:
Traceback (most recent call last):
File "/usr/bin/rosdep", line 33, in <module>
sys.exit(load_entry_point('rosdep==0.21.0', 'console_scripts', 'rosdep')())
File "/usr/bin/rosdep", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.8/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/rosdep2/__init__.py", line 45, in <module>
from .lookup import RosdepDefinition, RosdepView, RosdepLookup, \
File "/usr/lib/python3/dist-packages/rosdep2/lookup.py", line 44, in <module>
from .sources_list import SourcesListLoader
File "/usr/lib/python3/dist-packages/rosdep2/sources_list.py", line 50, in <module>
from .gbpdistro_support import get_gbprepo_as_rosdep_data, download_gbpdistro_as_rosdep_data
File "/usr/lib/python3/dist-packages/rosdep2/gbpdistro_support.py", line 20, in <module>
from .platforms.redhat import YUM_INSTALLER
File "/usr/lib/python3/dist-packages/rosdep2/platforms/redhat.py", line 34, in <module>
from rospkg.os_detect import (
ImportError: cannot import name 'OS_ALMALINUX' from 'rospkg.os_detect' (/usr/local/lib/python3.8/dist-packages/rospkg-1.2.8-py3.8.egg/rospkg/os_detect.py)
I tried to search on the forums to see if anyone had an error with importing 'OS_ALMALINUX' but I couldn't find any similar case.
Does anyone know how I can fix this issue?
Thank you

For me, the solution was to remove rospkg from pip (pip uninstall rospkg) and use rospkg installed from apt instead (sudo apt install python3-rospkg). It seems that the incorrect version was installed through pip or that there was some conflict between the pip and apt versions.

Related

cannot create piepenv in linux ubuntu

hello everyone…i have problem in launching venv using pipenv…i never had this problem in windows…I have recently migrated to linux Ubuntu…so i cannot solve this problem…I would be grateful if someone could help me
Creating a virtualenv for this project...
Pipfile: /media/sasan/F/my projects/Djprojects/newprj/Pipfile
Using /usr/bin/python3 (3.10.4) to create virtualenv...
⠸ Creating virtual environment...created virtual environment CPython3.10.4.final.0-64 in 106ms
creator CPython3Posix(dest=/home/sasan/.local/share/virtualenvs/newprj-cXkKfH7p, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/sasan/.local/share/virtualenv)
added seed packages: pip==22.2.2, setuptools==65.3.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
✔ Successfully created virtual environment!
Traceback (most recent call last):
File "/usr/bin/pipenv", line 33, in <module>
sys.exit(load_entry_point('pipenv==11.9.0', 'console_scripts', 'pipenv')())
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/cli/options.py", line 57, in main
return super().main(*args, **kwargs, windows_expand_args=False)
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/cli/command.py", line 397, in shell
do_shell(
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/core.py", line 2520, in do_shell
ensure_project(
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/core.py", line 525, in ensure_project
ensure_virtualenv(
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/core.py", line 458, in ensure_virtualenv
do_create_virtualenv(
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/core.py", line 959, in do_create_virtualenv
project._environment = Environment(
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/environment.py", line 79, in __init__
self._base_paths = self.get_paths()
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/environment.py", line 390, in get_paths
c = subprocess_run(command)
File "/home/sasan/.local/lib/python3.10/site-packages/pipenv/utils/processes.py", line 75, in subprocess_run
return subprocess.run(
File "/usr/lib/python3.10/subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/sasan/.local/share/virtualenvs/newprj-cXkKfH7p/bin/python'

*SOLVED* Error when trying to create the microros firmware with generate_lib as RTOS

I'm currently trying to make a custom message for a micro-ROS - Teensy communicaton. I found this tutorial on how to include custom ROS messages in micro-ROS. The first thing this tutorial says I should do is to go to "firmware/mcu_ws". So I tried to make this folder with the ros2 run micro_ros_setup create_firmware_ws.sh generate_lib command, but I always got this output.
I already tried reinstalling micro-ROS, reinstalling python3 and reinstalling the python3-catking-pkg, but nothing worked.
I'd really appreciate any help I can get.
(I had to remove the first 40 lines or so, because of the maximum character length, but they were also just cloning processes)
=== ./ros2/rosidl_defaults (git) ===
Cloning into '.'...
=== ./ros2/test_interface_files (git) ===
Cloning into '.'...
=== ./ros2/unique_identifier_msgs (git) ===
Cloning into '.'...
...........
=== ./eProsima/Micro-CDR (git) ===
Cloning into '.'...
=== ./eProsima/Micro-XRCE-DDS-Client (git) ===
Cloning into '.'...
=== ./uros/micro_ros_msgs (git) ===
Cloning into '.'...
=== ./uros/micro_ros_utilities (git) ===
Cloning into '.'...
=== ./uros/rcl (git) ===
Cloning into '.'...
=== ./uros/rclc (git) ===
Cloning into '.'...
=== ./uros/rcutils (git) ===
Cloning into '.'...
=== ./uros/rmw_microxrcedds (git) ===
Cloning into '.'...
=== ./uros/rosidl_typesupport (git) ===
Cloning into '.'...
=== ./uros/rosidl_typesupport_microxrcedds (git) ===
Cloning into '.'...
=== ./uros/tracetools (git) ===
Cloning into '.'...
Crosscompiled environment: cleaning path
[0.683s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/fabi/projects/install/example_interfaces' in the environment variable CMAKE_PREFIX_PATH doesn't exist
[0.683s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/fabi/projects/install/microxrcedds_client' in the environment variable CMAKE_PREFIX_PATH doesn't exist
[0.684s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/fabi/projects/install/microcdr' in the environment variable CMAKE_PREFIX_PATH doesn't exist
[0.684s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/fabi/projects/install/micro_ros_agent' in the environment variable CMAKE_PREFIX_PATH doesn't exist
[0.684s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/fabi/projects/install/CarCom' in the environment variable CMAKE_PREFIX_PATH doesn't exist
[0.684s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/fabi/projects/install/MXObjects' in the environment variable CMAKE_PREFIX_PATH doesn't exist
[0.684s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/fabi/projects/install/MXJoystick' in the environment variable CMAKE_PREFIX_PATH doesn't exist
[0.684s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/fabi/projects/microros_ws/install/microxrcedds_client' in the environment variable CMAKE_PREFIX_PATH doesn't exist
[0.684s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/fabi/projects/microros_ws/install/microcdr' in the environment variable CMAKE_PREFIX_PATH doesn't exist
Starting >>> ament_package
Starting >>> ament_lint
Starting >>> gtest_vendor
Starting >>> ament_cppcheck
Starting >>> ament_pycodestyle
Finished <<< gtest_vendor [1.83s]
Starting >>> gmock_vendor
Finished <<< gmock_vendor [0.24s]
--- stderr: ament_package
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/colcon_core/executor/__init__.py", line 91, in __call__
rc = await self.task(*args, **kwargs)
File "/usr/lib/python3/dist-packages/colcon_core/task/__init__.py", line 93, in __call__
return await task_method(*args, **kwargs)
File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_python/build.py", line 105, in build
return await extension.build(additional_hooks=additional_hooks)
File "/usr/lib/python3/dist-packages/colcon_core/task/python/build.py", line 59, in build
available_commands = await self._get_available_commands(
File "/usr/lib/python3/dist-packages/colcon_core/task/python/build.py", line 142, in _get_available_commands
output = await check_output(
File "/usr/lib/python3/dist-packages/colcon_core/subprocess.py", line 128, in check_output
assert not rc, f'Expected {args} to pass: {stderr_data}'
AssertionError: Expected ['/usr/bin/python3', 'setup.py', '--help-commands'] to pass: Traceback (most recent call last):
File "setup.py", line 6, in <module>
setup(
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 164, in setup
ok = dist.parse_command_line()
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 471, in parse_command_line
if self.handle_display_options(option_order):
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/dist.py", line 1185, in handle_display_options
return _Distribution.handle_display_options(self, option_order)
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 685, in handle_display_options
self.print_commands()
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/dist.py", line 962, in print_commands
cmdclass = ep.load()
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 194, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/fabi/.local/lib/python3.8/site-packages/sphinx/setup_command.py", line 20, in <module>
from sphinx.application import Sphinx
File "/home/fabi/.local/lib/python3.8/site-packages/sphinx/application.py", line 43, in <module>
from sphinx.registry import SphinxComponentRegistry
File "/home/fabi/.local/lib/python3.8/site-packages/sphinx/registry.py", line 24, in <module>
from sphinx.builders import Builder
File "/home/fabi/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 26, in <module>
from sphinx.util import import_object, logging, progress_message, rst, status_iterator
File "/home/fabi/.local/lib/python3.8/site-packages/sphinx/util/rst.py", line 21, in <module>
from jinja2 import Environment, environmentfilter
ImportError: cannot import name 'environmentfilter' from 'jinja2' (/home/fabi/.local/lib/python3.8/site-packages/jinja2/__init__.py)
---
Failed <<< ament_package [2.52s, exited with code 1]
Aborted <<< ament_pycodestyle [2.46s]
Aborted <<< ament_lint [2.52s]
Aborted <<< ament_cppcheck [2.51s]
Summary: 2 packages finished [2.99s]
1 package failed: ament_package
3 packages aborted: ament_cppcheck ament_lint ament_pycodestyle
1 package had stderr output: ament_package
54 packages not processed
Expected ['/usr/bin/python3', 'setup.py', '--help-commands'] to pass: Traceback (most recent call last):
File "setup.py", line 6, in <module>
setup(
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 164, in setup
ok = dist.parse_command_line()
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 471, in parse_command_line
if self.handle_display_options(option_order):
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/dist.py", line 1185, in handle_display_options
return _Distribution.handle_display_options(self, option_order)
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 685, in handle_display_options
self.print_commands()
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/dist.py", line 962, in print_commands
cmdclass = ep.load()
File "/home/fabi/.local/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 194, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/fabi/.local/lib/python3.8/site-packages/sphinx/setup_command.py", line 20, in <module>
from sphinx.application import Sphinx
File "/home/fabi/.local/lib/python3.8/site-packages/sphinx/application.py", line 43, in <module>
from sphinx.registry import SphinxComponentRegistry
File "/home/fabi/.local/lib/python3.8/site-packages/sphinx/registry.py", line 24, in <module>
from sphinx.builders import Builder
File "/home/fabi/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 26, in <module>
from sphinx.util import import_object, logging, progress_message, rst, status_iterator
File "/home/fabi/.local/lib/python3.8/site-packages/sphinx/util/rst.py", line 21, in <module>
from jinja2 import Environment, environmentfilter
ImportError: cannot import name 'environmentfilter' from 'jinja2' (/home/fabi/.local/lib/python3.8/site-packages/jinja2/__init__.py)```
Ok, I found the solution.
I solved it by removing the jinja2 version I had installed and installing an older version (3.0).

Downloading language model in Spacy breaks in docker

So my docker file has the following line
RUN python -m spacy download en_core_web_sm
Which throws an error stating thinc module is not found.
So, I decided to add the following line above the previous line.
RUN pip install thinc
When I compile I get the following error.
Step 30/48 : RUN pip install thinc
---> Running in 7ba293263245
Collecting thinc
Downloading https://files.pythonhosted.org/packages/25/99/e21c2a1622c193b2c93a628496fea4525a0ce93e3b47f3cb06559b6ff3ee/thinc-7.4.3.tar.gz (1.3MB)
Complete output from command python setup.py egg_info:
BLIS_COMPILER? None
WARNING: pip versions <19.3 (currently installed: 9.0.1) are unable to detect binary wheel compatibility for blis. To avoid a source install with a very long compilation time, please upgrade pip with `pip install --upgrade pip`.
If you know what you're doing and you really want to compile blis from source, please set the environment variable BLIS_REALLY_COMPILE=1.
Traceback (most recent call last):
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 157, in save_modules
yield saved
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 248, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 278, in run
return func()
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 246, in runner
_execfile(setup_script, ns)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 47, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-v4oqr4r6/blis-0.7.3/setup.py", line 219, in <module>
"cython>=0.25",
SystemExit: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/app-root/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1101, in run_setup
run_setup(setup_script, args)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 251, in run_setup
raise
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 169, in save_modules
saved_exc.resume()
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 144, in resume
six.reraise(type, exc, self._tb)
File "/opt/app-root/lib/python3.6/site-packages/pkg_resources/_vendor/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 157, in save_modules
yield saved
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 248, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 278, in run
return func()
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 246, in runner
_execfile(setup_script, ns)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/sandbox.py", line 47, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-v4oqr4r6/blis-0.7.3/setup.py", line 219, in <module>
"cython>=0.25",
SystemExit: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-_lc_0t4n/thinc/setup.py", line 276, in <module>
setup_package()
File "/tmp/pip-build-_lc_0t4n/thinc/setup.py", line 272, in setup_package
cmdclass={"build_ext": build_ext_subclass},
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/dist.py", line 315, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/opt/app-root/lib/python3.6/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs
replace_conflicting=True,
File "/opt/app-root/lib/python3.6/site-packages/pkg_resources/__init__.py", line 850, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/opt/app-root/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1122, in best_match
return self.obtain(req, installer)
File "/opt/app-root/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1134, in obtain
return installer(requirement)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/dist.py", line 429, in fetch_build_egg
return cmd.easy_install(req)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 665, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 695, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 876, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1115, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/opt/app-root/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1103, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with 1
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-_lc_0t4n/thinc/
You are using pip version 9.0.1, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The image is
FROM centos/python-36-centos7
before you install python packages add the following line
RUN pip install --upgrade pip

Why is importlib not able to import a module two levels up

I am trying to import a module with importlib but I am get No module named 'configuration'
This is my directory
I am trying to run app.py which loads configuration two levels up
I tried using
importlib.import_module( 'configuration' )
configuration_module = importlib.import_module( '.config_loader', package='configuration' )
it's not able to load configuration
--home
---configuration
---config.py
--- init.py
---restful
--- init.py
---application
--- app.py
--- config.py
--- __init__py
Traceback (most recent call last):
File "application/app.py", line 214, in <module>
app = create_app()
File "application/app.py", line 39, in create_app
importlib.import_module( 'configuration' )
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'configuration'

ImportError: cannot import name JSONClient

Whenever I request to GoogleVision api's, this error pops up. Even cannot install/uninstall any of the package
Sample Output:
engineer#engineer:~$ sudo pip install --upgrade google-cloud
[sudo] password for engineer:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2091, in _handle_ns
loader.load_module(packageName)
File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/home/engineer/.local/lib/python2.7/site-packages/google/cloud/logging/__init__.py", line 18, in <module>
from pkg_resources import get_distribution
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3036, in <module>
#_call_aside
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3020, in _call_aside
f(*args, **kwargs)
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3064, in _initialize_master_working_set
for dist in working_set
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3064, in <genexpr>
for dist in working_set
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2594, in activate
declare_namespace(pkg)
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2162, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2097, in _handle_ns
loader.load_module(packageName)
File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/usr/local/lib/python2.7/dist-packages/google/cloud/logging/__init__.py", line 18, in <module>
from google.cloud.logging.client import Client
File "/usr/local/lib/python2.7/dist-packages/google/cloud/logging/client.py", line 32, in <module>
from google.cloud.client import JSONClient
ImportError: cannot import name JSONClient
I had same issue today with 0.24.0 version,
I have downgraded google-cloud to 0.23.0 for now,
pip install --upgrade google-cloud==0.23.0
its working

Resources