Closed Luke1962 closed 2 years ago
today I've discovered that multiple versions are installed, both in /usr/local/lib/python3.8/dist-packages and ~/.local/lib/python3.8/site-packages When I import google.cloud (successfully) and print path variable , I get different paths:
pi@nano:~$ python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import google.cloud
>>> print(google.cloud.__path__)
_NamespacePath(['/usr/local/lib/python3.8/dist-packages/google/cloud', '/home/pi/.local/lib/python3.8/site-packages/google/cloud', '/home/pi/.local/lib/python3.8/site-packages/google_cloud_dialogflow-2.10.0-py3.8.egg/google/cloud'])
>>> from google.cloud import dialogflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/google/cloud/dialogflow/__init__.py", line 17, in <module>
from google.cloud.dialogflow_v2.services.agents.client import AgentsClient
File "/usr/local/lib/python3.8/dist-packages/google/cloud/dialogflow_v2/__init__.py", line 17, in <module>
from .services.agents import AgentsClient
File "/usr/local/lib/python3.8/dist-packages/google/cloud/dialogflow_v2/services/agents/__init__.py", line 16, in <module>
from .client import AgentsClient
File "/usr/local/lib/python3.8/dist-packages/google/cloud/dialogflow_v2/services/agents/client.py", line 23, in <module>
from google.api_core import exceptions as core_exceptions
File "/usr/local/lib/python3.8/dist-packages/google/api_core/exceptions.py", line 28, in <module>
from google.rpc import error_details_pb2
File "/usr/local/lib/python3.8/dist-packages/google/rpc/error_details_pb2.py", line 38, in <module>
create_key=_descriptor._internal_create_key,
AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'
>>>
I get the same exception even if I alternatively remove one of two path before import, with
sys.path.remove("/home/pi/.local/lib/python3.8/site-packages")
or
sys.path.remove("/usr/local/lib/python3.8/dist-packages")
By sure someone will tell me to use virtualenv, but since this is a robot system , where all packages shall run together, I wander that at the end I'd reproduce into the virtualenv the same problems I'm facing installing all packages at system level. Any suggestion would be appreciated
Just FYI, here's what I observed using a fresh virtual environment.
After running pip install google-cloud-dialogflow
:
Python 3.8.12 (default, Jan 18 2022, 19:39:18)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import dialogflow
>>>
Have you tried uninstalling all packages first with: pip uninstall -y -r <(pip freeze)
?
Removing all python packages would destroy too much work to me. I tried virtual environment way, but I anticipate without success (same error).
pip freeze
command):google-api-core==2.2.2
google-auth==2.3.3
google-auth-oauthlib==0.4.6
google-cloud==0.34.0
google-cloud-dialogflow==2.10.0
google-pasta==0.2.0
googleapis-common-protos==1.54.0
grpcio==1.43.0
grpcio-status==1.43.0
proto-plus==1.19.8
protobuf==3.19.3
Then I uninstalled them with
sudo pip uninstall -y -r requirements_dialogflow.txt
I've created a fresh virtual env with
pi@nano:~$ mkvirtualenv df
created virtual environment CPython3.8.10.final.0-64 in 532ms
creator CPython3Posix(dest=/home/pi/.virtualenvs/df, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/pi/.local/share/virtualenv)
added seed packages: pip==21.3.1, setuptools==60.2.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/df/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/df/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/df/bin/preactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/df/bin/postactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/df/bin/get_env_details
(df) pi@nano:~$
I've installed google-cloud-dialogflow:
(df) pi@nano:~$ pip install google-cloud-dialogflow
Collecting google-cloud-dialogflow
Using cached google_cloud_dialogflow-2.11.0-py2.py3-none-any.whl (1.3 MB)
Collecting google-api-core[grpc]<3.0.0dev,>=1.28.0
Downloading google_api_core-2.4.0-py2.py3-none-any.whl (111 kB)
Collecting proto-plus>=1.10.0 Downloading proto_plus-1.19.9-py3-none-any.whl (45 kB)
Collecting protobuf>=3.12.0 Downloading protobuf-3.19.4-cp38-cp38-manylinux2014_aarch64.whl (913 kB)
Collecting googleapis-common-protos<2.0dev,>=1.52.0 Using cached googleapis_common_protos-1.54.0-py2.py3-none-any.whl (207 kB) Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in /usr/lib/python3/dist-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (2.22.0) Collecting google-auth<3.0dev,>=1.25.0 Downloading google_auth-2.5.0-py2.py3-none-any.whl (157 kB)
Requirement already satisfied: setuptools>=40.3.0 in /usr/lib/python3/dist-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (45.2.0) Processing ./.cache/pip/wheels/75/43/ee/d6fff4bfd9d7a09ea9e81431dd321b13c43a4960b64be34016/grpcio-1.43.0-cp38-cp38-linux_aarch64.whl Collecting grpcio-status<2.0dev,>=1.33.2; extra == "grpc" Using cached grpcio_status-1.43.0-py3-none-any.whl (10.0 kB) Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (1.14.0) Requirement already satisfied: rsa<5,>=3.1.4; python_version >= "3.6" in /usr/local/lib/python3.8/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (4.8) Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/lib/python3/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (0.2.1) Requirement already satisfied: cachetools<6.0,>=2.0.0 in /usr/local/lib/python3.8/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (4.2.4) Requirement already satisfied: pyasn1>=0.1.3 in /usr/lib/python3/dist-packages (from rsa<5,>=3.1.4; python_version >= "3.6"->google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (0.4.2) Installing collected packages: protobuf, googleapis-common-protos, google-auth, grpcio, grpcio-status, google-api-core, proto-plus, google-cloud-dialogflow Successfully installed google-api-core-2.4.0 google-auth-2.5.0 google-cloud-dialogflow-2.11.0 googleapis-common-protos-1.54.0 grpcio-1.43.0 grpcio-status-1.43.0 proto-plus-1.19.9 protobuf-3.19.4 (df) pi@nano:~$ python3 Python 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
Please note that protobuf 3.19.4 has been installed inside (df) Virtual env.
5. try import into Python:
(df) pi@nano:~$ python3 Python 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
from google.cloud import dialogflow Traceback (most recent call last): File "
", line 1, in File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/cloud/dialogflow/init.py", line 17, in from google.cloud.dialogflow_v2.services.agents.client import AgentsClient File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/cloud/dialogflow_v2/init.py", line 17, in from .services.agents import AgentsClient File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/cloud/dialogflow_v2/services/agents/init.py", line 16, in from .client import AgentsClient File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/cloud/dialogflow_v2/services/agents/client.py", line 23, in from google.api_core import exceptions as core_exceptions File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/api_core/exceptions.py", line 28, in from google.rpc import error_details_pb2 File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/rpc/error_details_pb2.py", line 38, in create_key=_descriptor._internal_create_key, AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key' exit() As far as I can understand, this is the same error on protobuf 3.19.3, I initially reported. Maybe I've not uninstalled some packages at system level, protobuf depends on, but the last error point to protobuf, not to other modules.
(df) pi@nano:~$ pip show protobuf Name: protobuf Version: 3.19.4 Summary: Protocol Buffers Home-page: https://developers.google.com/protocol-buffers/ Author: None Author-email: None License: 3-Clause BSD License Location: /home/pi/.virtualenvs/df/lib/python3.8/site-packages Requires: Required-by: proto-plus, grpcio-status, googleapis-common-protos, google-api-core (df) pi@nano:~$
May be related to ARM platform?
I've repeated the installation with --ignore-installed option, but same result. (please note that all error chain refers to files inside virtual env):
pi@nano:~$ workon df
(df) pi@nano:~$ pip install google-cloud-dialogflow --ignore-installed
Collecting google-cloud-dialogflow
Using cached google_cloud_dialogflow-2.11.0-py2.py3-none-any.whl (1.3 MB)
Collecting google-api-core[grpc]<3.0.0dev,>=1.28.0
Using cached google_api_core-2.4.0-py2.py3-none-any.whl (111 kB)
Collecting proto-plus>=1.10.0
Using cached proto_plus-1.19.9-py3-none-any.whl (45 kB)
Collecting requests<3.0.0dev,>=2.18.0
Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting setuptools>=40.3.0
Using cached setuptools-60.5.0-py3-none-any.whl (958 kB)
Collecting googleapis-common-protos<2.0dev,>=1.52.0
Using cached googleapis_common_protos-1.54.0-py2.py3-none-any.whl (207 kB)
Collecting google-auth<3.0dev,>=1.25.0
Using cached google_auth-2.5.0-py2.py3-none-any.whl (157 kB)
Collecting protobuf>=3.12.0
Using cached protobuf-3.19.4-cp38-cp38-manylinux2014_aarch64.whl (913 kB)
Collecting grpcio-status<2.0dev,>=1.33.2; extra == "grpc"
Using cached grpcio_status-1.43.0-py3-none-any.whl (10.0 kB)
Processing ./.cache/pip/wheels/75/43/ee/d6fff4bfd9d7a09ea9e81431dd321b13c43a4960b64be34016/grpcio-1.43.0-cp38-cp38-linux_aarch64.whl
Collecting charset-normalizer~=2.0.0; python_version >= "3"
Downloading charset_normalizer-2.0.10-py3-none-any.whl (39 kB)
Collecting urllib3<1.27,>=1.21.1
Downloading urllib3-1.26.8-py2.py3-none-any.whl (138 kB)
Collecting idna<4,>=2.5; python_version >= "3"
Downloading idna-3.3-py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting pyasn1-modules>=0.2.1
Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
Collecting cachetools<6.0,>=2.0.0
Downloading cachetools-5.0.0-py3-none-any.whl (9.1 kB)
Collecting rsa<5,>=3.1.4; python_version >= "3.6"
Downloading rsa-4.8-py3-none-any.whl (39 kB)
Collecting six>=1.9.0
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pyasn1<0.5.0,>=0.4.6
Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
Installing collected packages: charset-normalizer, urllib3, idna, certifi, requests, setuptools, protobuf, googleapis-common-protos, pyasn1, pyasn1-modules, cachetools, rsa, six, google-auth, grpcio, grpcio-status, google-api-core, proto-plus, google-cloud-dialogflow
Successfully installed cachetools-5.0.0 certifi-2021.10.8 charset-normalizer-2.0.10 google-api-core-2.4.0 google-auth-2.5.0 google-cloud-dialogflow-2.11.0 googleapis-common-protos-1.54.0 grpcio-1.43.0 grpcio-status-1.43.0 idna-3.3 proto-plus-1.19.9 protobuf-3.19.4 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.27.1 rsa-4.8 setuptools-60.5.0 six-1.16.0 urllib3-1.26.8
(df) pi@nano:~$ python
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import dialogflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/cloud/dialogflow/__init__.py", line 17, in <module>
from google.cloud.dialogflow_v2.services.agents.client import AgentsClient
File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/cloud/dialogflow_v2/__init__.py", line 17, in <module>
from .services.agents import AgentsClient
File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/cloud/dialogflow_v2/services/agents/__init__.py", line 16, in <module>
from .client import AgentsClient
File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/cloud/dialogflow_v2/services/agents/client.py", line 23, in <module>
from google.api_core import exceptions as core_exceptions
File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/api_core/exceptions.py", line 28, in <module>
from google.rpc import error_details_pb2
File "/home/pi/.virtualenvs/df/lib/python3.8/site-packages/google/rpc/error_details_pb2.py", line 38, in <module>
create_key=_descriptor._internal_create_key,
AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'
>>>
I dont know if this is relevant, but protoc --version command returns a different version from pip show protobuf
(df) pi@nano:~$ protoc --version
libprotoc 3.6.1
(df) pi@nano:~$ pip show protobuf
Name: protobuf
Version: 3.19.4
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: None
Author-email: None
License: 3-Clause BSD License
Location: /home/pi/.virtualenvs/df/lib/python3.8/site-packages
Requires:
Required-by: proto-plus, grpcio-status, googleapis-common-protos, google-api-core
However I'd prefer not uninstall it due to several dependencies
pi@nano:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@nano:~$ sudo apt remove libprotoc-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fltk1.3-doc fluid gazebo11 gazebo11-common gazebo11-plugin-base
ignition-tools libassimp-dev libassimp5 libavdevice-dev libavfilter-dev
libccd-dev libccd2 libdart-collision-bullet-dev libdart-collision-ode-dev
libdart-dev libdart-external-ikfast-dev libdart-external-odelcpsolver-dev
libdart-utils-dev libdart-utils-urdf-dev libdart6 libdart6-collision-bullet
libdart6-collision-ode libdart6-external-odelcpsolver libdart6-utils
libdart6-utils-urdf libfcl-dev libfcl0.5 libfltk-cairo1.3 libfltk-forms1.3
libfltk1.3-dev libfreeimage-dev libfreeimage3 libgazebo11 libgts-dev
libignition-cmake2-dev libignition-common3 libignition-common3-av
libignition-common3-av-dev libignition-common3-core-dev
libignition-common3-dev libignition-common3-events
libignition-common3-events-dev libignition-common3-graphics
libignition-common3-graphics-dev libignition-common3-profiler
libignition-common3-profiler-dev libignition-fuel-tools4 libignition-math6
libignition-math6-dev libignition-msgs5 libignition-tools-dev
libignition-transport8 libignition-transport8-log libjxr0 libnorm-dev
liboctomap-dev liboctomap1.9 libode-dev libode8 libogre-1.9-dev
libogre-1.9.0v5 libpgm-dev libpostproc-dev libqwt-qt5-6 libqwt-qt5-dev
libsdformat9 libsdformat9-dev libsimbody-dev libsimbody3.6 libsodium-dev
libspnav0 libtar-dev libtar0 liburdfdom-dev liburdfdom-headers-dev
liburdfdom-model liburdfdom-model-state liburdfdom-sensor liburdfdom-world
libyaml-dev libzip-dev libzip5 libzmq3-dev libzzip-0-13 python3-opengl
python3-pydot python3-pyqt5.qtopengl python3-pyqt5.qtwebkit
ros-noetic-actionlib-tutorials ros-noetic-bond-core ros-noetic-bondpy
ros-noetic-camera-calibration ros-noetic-cmake-modules
ros-noetic-common-msgs ros-noetic-common-tutorials
ros-noetic-compressed-depth-image-transport
ros-noetic-compressed-image-transport ros-noetic-control-msgs
ros-noetic-control-toolbox ros-noetic-controller-interface
ros-noetic-controller-manager ros-noetic-controller-manager-msgs
ros-noetic-depth-image-proc ros-noetic-desktop
ros-noetic-diagnostic-aggregator ros-noetic-diagnostic-analysis
ros-noetic-diagnostic-common-diagnostics ros-noetic-diagnostics
ros-noetic-diff-drive-controller ros-noetic-eigen-conversions
ros-noetic-executive-smach ros-noetic-filters
ros-noetic-forward-command-controller ros-noetic-gazebo-msgs
ros-noetic-geometry ros-noetic-geometry-tutorials ros-noetic-gl-dependency
ros-noetic-hardware-interface ros-noetic-image-common
ros-noetic-image-geometry ros-noetic-image-pipeline ros-noetic-image-proc
ros-noetic-image-publisher ros-noetic-image-rotate
ros-noetic-image-transport-plugins ros-noetic-image-view
ros-noetic-interactive-marker-tutorials ros-noetic-joint-limits-interface
ros-noetic-joint-state-controller ros-noetic-joint-state-publisher
ros-noetic-joint-state-publisher-gui ros-noetic-kdl-conversions
ros-noetic-kdl-parser ros-noetic-laser-assembler ros-noetic-laser-filters
ros-noetic-laser-pipeline ros-noetic-librviz-tutorial
ros-noetic-media-export ros-noetic-mk ros-noetic-nodelet-core
ros-noetic-nodelet-topic-tools ros-noetic-nodelet-tutorial-math
ros-noetic-pcl-conversions ros-noetic-pcl-msgs ros-noetic-pcl-ros
ros-noetic-perception ros-noetic-perception-pcl
ros-noetic-pluginlib-tutorials ros-noetic-polled-camera
ros-noetic-position-controllers ros-noetic-qt-dotgraph
ros-noetic-qt-gui-py-common ros-noetic-qwt-dependency
ros-noetic-realtime-tools ros-noetic-resource-retriever ros-noetic-robot
ros-noetic-robot-state-publisher ros-noetic-ros ros-noetic-ros-base
ros-noetic-ros-comm ros-noetic-ros-core ros-noetic-ros-tutorials
ros-noetic-rosbag-migration-rule ros-noetic-rosbash ros-noetic-rosboost-cfg
ros-noetic-rosconsole-bridge ros-noetic-roscpp-core
ros-noetic-roscpp-tutorials ros-noetic-roscreate ros-noetic-roslang
ros-noetic-roslint ros-noetic-roslisp ros-noetic-rosmake
ros-noetic-rospy-tutorials ros-noetic-rqt-action ros-noetic-rqt-bag
ros-noetic-rqt-bag-plugins ros-noetic-rqt-common-plugins
ros-noetic-rqt-console ros-noetic-rqt-dep ros-noetic-rqt-graph
ros-noetic-rqt-gui ros-noetic-rqt-gui-cpp ros-noetic-rqt-gui-py
ros-noetic-rqt-image-view ros-noetic-rqt-launch ros-noetic-rqt-logger-level
ros-noetic-rqt-moveit ros-noetic-rqt-msg ros-noetic-rqt-nav-view
ros-noetic-rqt-plot ros-noetic-rqt-pose-view ros-noetic-rqt-publisher
ros-noetic-rqt-py-common ros-noetic-rqt-py-console
ros-noetic-rqt-reconfigure ros-noetic-rqt-robot-dashboard
ros-noetic-rqt-robot-monitor ros-noetic-rqt-robot-plugins
ros-noetic-rqt-robot-steering ros-noetic-rqt-runtime-monitor
ros-noetic-rqt-rviz ros-noetic-rqt-service-caller ros-noetic-rqt-shell
ros-noetic-rqt-srv ros-noetic-rqt-tf-tree ros-noetic-rqt-top
ros-noetic-rqt-topic ros-noetic-rqt-web ros-noetic-rviz
ros-noetic-rviz-plugin-tutorials ros-noetic-rviz-python-tutorial
ros-noetic-self-test ros-noetic-shape-msgs ros-noetic-smach
ros-noetic-smach-msgs ros-noetic-smach-ros ros-noetic-stage
ros-noetic-stage-ros ros-noetic-stereo-image-proc ros-noetic-stereo-msgs
ros-noetic-tf-conversions ros-noetic-tf2-eigen ros-noetic-tf2-kdl
ros-noetic-theora-image-transport ros-noetic-trajectory-msgs
ros-noetic-transmission-interface ros-noetic-turtle-actionlib
ros-noetic-turtle-tf ros-noetic-turtle-tf2 ros-noetic-turtlesim
ros-noetic-urdf ros-noetic-urdf-parser-plugin ros-noetic-urdf-tutorial
ros-noetic-vision-opencv ros-noetic-visualization-marker-tutorials
ros-noetic-visualization-tutorials ros-noetic-viz
ros-noetic-webkit-dependency ros-noetic-xacro sbcl sdformat9-sdf
ttf-dejavu-core
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
libgazebo11-dev libignition-fuel-tools4-dev libignition-msgs5-dev
libignition-transport8-core-dev libignition-transport8-dev
libignition-transport8-log-dev libprotoc-dev ros-noetic-desktop-full
ros-noetic-gazebo-dev ros-noetic-gazebo-plugins ros-noetic-gazebo-ros
ros-noetic-gazebo-ros-control ros-noetic-gazebo-ros-pkgs
ros-noetic-simulators ros-noetic-urdf-sim-tutorial
0 upgraded, 0 newly installed, 15 to remove and 0 not upgraded.
After this operation, 42.9 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.
pi@nano:~$
May be this version mismatch is interfering with virtual environment?
What happens if you install the Dialogflow client library in a fresh virtual environment without any other packages? For example what happens if you run:
$ mkvirtualenv df-fresh
(df-fresh) $ pip install google-cloud-dialogflow
(df-fresh) $ python
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import dialogflow
>>>
This is what happens:
pi@nano:~$
pi@nano:~$
pi@nano:~$
pi@nano:~$ mkvirtualenv df-fresh
created virtual environment CPython3.8.10.final.0-64 in 880ms
creator CPython3Posix(dest=/home/pi/.virtualenvs/df-fresh, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/pi/.local/share/virtualenv)
added seed packages: pip==21.3.1, setuptools==60.2.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/df-fresh/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/df-fresh/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/df-fresh/bin/preactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/df-fresh/bin/postactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/df-fresh/bin/get_env_details
(df-fresh) pi@nano:~$ pip install google-cloud-dialogflow
Collecting google-cloud-dialogflow
Using cached google_cloud_dialogflow-2.11.0-py2.py3-none-any.whl (1.3 MB)
Collecting google-api-core[grpc]<3.0.0dev,>=1.28.0
Using cached google_api_core-2.4.0-py2.py3-none-any.whl (111 kB)
Collecting proto-plus>=1.10.0
Using cached proto_plus-1.19.9-py3-none-any.whl (45 kB)
Requirement already satisfied: setuptools>=40.3.0 in /usr/lib/python3/dist-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (45.2.0)
Collecting protobuf>=3.12.0
Using cached protobuf-3.19.4-cp38-cp38-manylinux2014_aarch64.whl (913 kB)
Collecting google-auth<3.0dev,>=1.25.0
Downloading google_auth-2.6.0-py2.py3-none-any.whl (156 kB)
|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 156 kB 226 kB/s
Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in /usr/lib/python3/dist-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (2.22.0)
Collecting googleapis-common-protos<2.0dev,>=1.52.0
Using cached googleapis_common_protos-1.54.0-py2.py3-none-any.whl (207 kB)
Processing ./.cache/pip/wheels/75/43/ee/d6fff4bfd9d7a09ea9e81431dd321b13c43a4960b64be34016/grpcio-1.43.0-cp38-cp38-linux_aarch64.whl
Collecting grpcio-status<2.0dev,>=1.33.2; extra == "grpc"
Using cached grpcio_status-1.43.0-py3-none-any.whl (10.0 kB)
Requirement already satisfied: cachetools<6.0,>=2.0.0 in /usr/local/lib/python3.8/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (4.2.4)
Requirement already satisfied: rsa<5,>=3.1.4; python_version >= "3.6" in /usr/local/lib/python3.8/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (4.8)
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (1.14.0)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/lib/python3/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (0.2.1)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/lib/python3/dist-packages (from rsa<5,>=3.1.4; python_version >= "3.6"->google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (0.4.2)
Installing collected packages: protobuf, google-auth, googleapis-common-protos, grpcio, grpcio-status, google-api-core, proto-plus, google-cloud-dialogflow
Successfully installed google-api-core-2.4.0 google-auth-2.6.0 google-cloud-dialogflow-2.11.0 googleapis-common-protos-1.54.0 grpcio-1.43.0 grpcio-status-1.43.0 proto-plus-1.19.9 protobuf-3.19.4
(df-fresh) pi@nano:~$ python
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import dialogflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/cloud/dialogflow/__init__.py", line 17, in <module>
from google.cloud.dialogflow_v2.services.agents.client import AgentsClient
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/cloud/dialogflow_v2/__init__.py", line 17, in <module>
from .services.agents import AgentsClient
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/cloud/dialogflow_v2/services/agents/__init__.py", line 16, in <module>
from .client import AgentsClient
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/cloud/dialogflow_v2/services/agents/client.py", line 23, in <module>
from google.api_core import exceptions as core_exceptions
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/api_core/exceptions.py", line 28, in <module>
from google.rpc import error_details_pb2
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/rpc/error_details_pb2.py", line 38, in <module>
create_key=_descriptor._internal_create_key,
AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'
>>>
I tried also with --ignore-installed option to avoid interference with packages already installed packages at system level, and this is the result:
>>> exit()
(df-fresh) pi@nano:~$ pip install google-cloud-dialogflow --ignore-installed
Collecting google-cloud-dialogflow
Using cached google_cloud_dialogflow-2.11.0-py2.py3-none-any.whl (1.3 MB)
Collecting google-api-core[grpc]<3.0.0dev,>=1.28.0
Using cached google_api_core-2.4.0-py2.py3-none-any.whl (111 kB)
Collecting proto-plus>=1.10.0
Using cached proto_plus-1.19.9-py3-none-any.whl (45 kB)
Collecting requests<3.0.0dev,>=2.18.0
Using cached requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting setuptools>=40.3.0
Downloading setuptools-60.7.0-py3-none-any.whl (1.0 MB)
Collecting protobuf>=3.12.0
Using cached protobuf-3.19.4-cp38-cp38-manylinux2014_aarch64.whl (913 kB)
Collecting google-auth<3.0dev,>=1.25.0
Using cached google_auth-2.6.0-py2.py3-none-any.whl (156 kB)
Collecting googleapis-common-protos<2.0dev,>=1.52.0
Using cached googleapis_common_protos-1.54.0-py2.py3-none-any.whl (207 kB)
Collecting grpcio-status<2.0dev,>=1.33.2; extra == "grpc"
Using cached grpcio_status-1.43.0-py3-none-any.whl (10.0 kB)
Processing ./.cache/pip/wheels/75/43/ee/d6fff4bfd9d7a09ea9e81431dd321b13c43a4960b64be34016/grpcio-1.43.0-cp38-cp38-linux_aarch64.whl
Collecting certifi>=2017.4.17
Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting charset-normalizer~=2.0.0; python_version >= "3"
Downloading charset_normalizer-2.0.11-py3-none-any.whl (39 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.8-py2.py3-none-any.whl (138 kB)
Collecting idna<4,>=2.5; python_version >= "3"
Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting six>=1.9.0
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting cachetools<6.0,>=2.0.0
Using cached cachetools-5.0.0-py3-none-any.whl (9.1 kB)
Collecting rsa<5,>=3.1.4; python_version >= "3.6"
Using cached rsa-4.8-py3-none-any.whl (39 kB)
Collecting pyasn1-modules>=0.2.1
Using cached pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
Collecting pyasn1>=0.1.3
Using cached pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
Installing collected packages: certifi, charset-normalizer, urllib3, idna, requests, setuptools, protobuf, six, cachetools, pyasn1, rsa, pyasn1-modules, google-auth, googleapis-common-protos, grpcio, grpcio-status, google-api-core, proto-plus, google-cloud-dialogflow
Successfully installed cachetools-5.0.0 certifi-2021.10.8 charset-normalizer-2.0.11 google-api-core-2.4.0 google-auth-2.6.0 google-cloud-dialogflow-2.11.0 googleapis-common-protos-1.54.0 grpcio-1.43.0 grpcio-status-1.43.0 idna-3.3 proto-plus-1.19.9 protobuf-3.19.4 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.27.1 rsa-4.8 setuptools-60.7.0 six-1.16.0 urllib3-1.26.8
(df-fresh) pi@nano:~$ python
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import dialogflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/cloud/dialogflow/__init__.py", line 17, in <module>
from google.cloud.dialogflow_v2.services.agents.client import AgentsClient
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/cloud/dialogflow_v2/__init__.py", line 17, in <module>
from .services.agents import AgentsClient
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/cloud/dialogflow_v2/services/agents/__init__.py", line 16, in <module>
from .client import AgentsClient
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/cloud/dialogflow_v2/services/agents/client.py", line 23, in <module>
from google.api_core import exceptions as core_exceptions
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/api_core/exceptions.py", line 28, in <module>
from google.rpc import error_details_pb2
File "/home/pi/.virtualenvs/df-fresh/lib/python3.8/site-packages/google/rpc/error_details_pb2.py", line 38, in <module>
create_key=_descriptor._internal_create_key,
AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'
>>>
Is it possible that the error comes from some incompatibility between: a) protobuf version 3.19.4 , installed with pip (from pip install google-cloud-dialogflow)
pi@nano:~$ pip3 show protobuf
Name: protobuf
Version: 3.19.4
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: None
Author-email: None
License: 3-Clause BSD License
Location: /home/pi/.local/lib/python3.8/site-packages
Requires:
Required-by: proto-plus, grpcio-status, googleapis-common-protos, google-api-core
b) and the installed library libprotobuf-dev (installed with apt I presume) ?
pi@nano:~$ apt list |grep libprotobuf-
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libprotobuf-c-dev/focal 1.3.3-1 arm64
libprotobuf-c1/focal 1.3.3-1 arm64
libprotobuf-dev/focal,now 3.6.1.3-2ubuntu5 arm64 [installed]
libprotobuf-java-format-java/focal 1.3-1 all
libprotobuf-java/focal 3.6.1.3-2ubuntu5 all
libprotobuf-lite17/focal,now 3.6.1.3-2ubuntu5 arm64 [installed,automatic]
libprotobuf-dev is already the most recent version available:
pi@nano:~$ sudo apt install libprotobuf-dev --upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
libprotobuf-dev is already the newest version (3.6.1.3-2ubuntu5).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Unless this is considered with high degree of confidence the reason for dialogflow not working, I prefer not to remove libprobuf-dev, since many ROS packages depend on:
pi@nano:~$ sudo apt remove libprotobuf-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libgazebo11-dev libignition-fuel-tools4-dev libignition-msgs5-dev libignition-transport8-core-dev libignition-transport8-dev
libignition-transport8-log-dev libprotobuf-dev libprotoc-dev ros-noetic-desktop-full ros-noetic-gazebo-dev
ros-noetic-gazebo-plugins ros-noetic-gazebo-ros ros-noetic-gazebo-ros-control ros-noetic-gazebo-ros-pkgs
ros-noetic-simulators ros-noetic-urdf-sim-tutorial
0 upgraded, 0 newly installed, 16 to remove and 3 not upgraded.
After this operation, 52.9 MB disk space will be freed.
Do you want to continue? [Y/n] n
Some progress obtained changing $PYTHONPATH variable in .bashrc
Before the distro path had the precedence
export PYTHONPATH=$PYTHONPATH:/usr/lib/python3/dist-packages:/usr/local/lib/python3.8/dist-packages:/opt/ros/noetic/lib/python3/dist-packages
Now, with the following settings:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.8/dist-packages:/opt/ros/noetic/lib/python3/dist-packages:/usr/lib/python3/dist-packages
which gives me th following result:
pi@nano:~$ echo $PYTHONPATH
/home/pi/ros/devel/lib/python3/dist-packages:/opt/ros/noetic/lib/python3/dist-packages:/usr/local/lib/python3.8/dist-packages:/usr/lib/python3/dist-packages
and repeating the installation into virtual environment, I obtain only some warning messages:
pi@nano:~$ mkvirtualenv df-fresh
created virtual environment CPython3.8.10.final.0-64 in 1876ms
creator CPython3Posix(dest=/home/pi/.virtualenvs/df-fresh, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/pi/.local/share/virtualenv)
added seed packages: cachetools==5.0.0, certifi==2021.10.8, charset_normalizer==2.0.11, google_api_core==2.4.0, google_auth==2.6.0, google_cloud_dialogflow==2.11.0, googleapis_common_protos==1.54.0, grpcio==1.43.0, grpcio_status==1.43.0, idna==3.3, pip==22.0.3, proto_plus==1.19.9, protobuf==3.19.4, pyasn1==0.4.8, pyasn1_modules==0.2.8, requests==2.27.1, rsa==4.8, setuptools==60.2.0, setuptools==60.9.3, six==1.16.0, urllib3==1.26.8, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
(df-fresh) pi@nano:~$ pip install google-cloud-dialogflow
Requirement already satisfied: google-cloud-dialogflow in ./.virtualenvs/df-fresh/lib/python3.8/site-packages (2.11.0)
Requirement already satisfied: proto-plus>=1.10.0 in ./.virtualenvs/df-fresh/lib/python3.8/site-packages (from google-cloud-dialogflow) (1.19.9)
Requirement already satisfied: google-api-core[grpc]<3.0.0dev,>=1.28.0 in ./.virtualenvs/df-fresh/lib/python3.8/site-packages (from google-cloud-dialogflow) (2.4.0)
Requirement already satisfied: google-auth<3.0dev,>=1.25.0 in /usr/local/lib/python3.8/dist-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (2.6.2)
Requirement already satisfied: setuptools>=40.3.0 in /usr/local/lib/python3.8/dist-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (60.10.0)
Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.52.0 in ./.virtualenvs/df-fresh/lib/python3.8/site-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (1.54.0)
Requirement already satisfied: protobuf>=3.12.0 in /usr/local/lib/python3.8/dist-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (3.19.4)
Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in /usr/local/lib/python3.8/dist-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (2.27.1)
Requirement already satisfied: grpcio-status<2.0dev,>=1.33.2 in ./.virtualenvs/df-fresh/lib/python3.8/site-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (1.43.0)
Requirement already satisfied: grpcio<2.0dev,>=1.33.2 in /usr/local/lib/python3.8/dist-packages (from google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (1.44.0)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.8/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (0.2.8)
Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.8/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (4.8)
Requirement already satisfied: six>=1.9.0 in /usr/local/lib/python3.8/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (1.16.0)
Requirement already satisfied: cachetools<6.0,>=2.0.0 in /usr/local/lib/python3.8/dist-packages (from google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (4.2.4)
Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.8/dist-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (2.0.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/dist-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (1.26.8)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/dist-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (2021.10.8)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.8/dist-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (3.3)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.8/dist-packages (from pyasn1-modules>=0.2.1->google-auth<3.0dev,>=1.25.0->google-api-core[grpc]<3.0.0dev,>=1.28.0->google-cloud-dialogflow) (0.4.8)
(df-fresh) pi@nano:~$ python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import dialogflow
/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: 0.1.36ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: 1.13.1-unknown is an invalid version and will not be supported in a future release
warnings.warn(
/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: 0.23ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
>>>
So I suppose that the original problem I have reported can be considered solved, even if now I have other kind of issue, but they would be off-topic
Hi, its quite strange to me to be the first reporting an issue.... My system is a robot based on:
-DF Essential ( cloud side)
Since several days I'm trying to install dialogflow (previously working on same machine but under Ubuntu 18.04). Every time I was receiving some red error messages , related to requirements not satisfied. ( also after forcing installation of specific versions like
sudo -H pip3 install --force-reinstall google-auth==1.35.0
and following the few suggestions found on stackoverflow on this topic). Howerver, after several trials, after removing Tensorboard, Tensorflow, dialogflow, and forcing reinstall of other libraries I've got (apparently) a clean installation (i.e. without error messages):However if I try to import the library in python3.8 , I get the following errors (evn if TF is no more installed): ` pi@nano:~$ python3 Python 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.