on Ubuntu 20.04 and I can't import protobuf :
(r-torch) brucezepplin#brucezepplin-HP-ProBook-440-G7:~$ conda list | grep protobuf
libprotobuf 3.17.2 h4ff587b_1
protobuf 3.17.2 py39h295c915_0
(r-torch) brucezepplin#brucezepplin-HP-ProBook-440-G7:~$ python
Python 3.9.7 (default, Sep 16 2021, 13:09:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import protobuf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'protobuf'
any ideas?
The python package for protobuf has a package structure that uses google as an root prefix:
import google.protobuf
from google.protobuf import <pkg-name>
Related
I am trying to get a module slackclient installed in a virtual Python environment.
python3 -m venv slackenv
. slackenv/activate
pip3 install slackclient
I get
python3.7
Python 3.7.6 (default, Jan 12 2022, 23:27:58)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import slackclient
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'slackclient'
This is with slackclient installed both in the virtualenv and in the main system pip list. (It shows up in both lists).
What could be the issue?
Despite the name of the package is slackclient, the actual module is slack, as can you see in the official page of the package. So, try this one:
import slack
it should work.
I'm trying to install OpenCV on my raspberry pi 3(I'm using this tutorial https://linuxize.com/post/how-to-install-opencv-on-raspberry-pi/) after installation finished, I check it using the c++ library the module OpenCV has been installed
pi#raspberrypi:~ $ pkg-config --modversion opencv4
4.5.5
and when I use the python library the result is
pi#raspberrypi:~ $ python3
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'
>>>
and then I check-in /usr/local/lib/python3.9/site-packages
pi#raspberrypi:/usr/local/lib/python3.9/site-packages $ ls
cv2
I have Ubuntu 18.04 and I have installed Miniconda and python 3.9
I have pytest installed and verify it like so:
which pytest
/usr/bin/pytest
When I try to import it from python I get the error: 'No module named 'pytest'
python3
Python 3.9.5 (default, Jun 4 2021, 12:28:51)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pytest'
How can I solve this?
You have pytest installed, but not in your conda env - /usr/bin/pytest is not a location that conda installs to. You need to install it by running
conda install -c conda-forge pytest
I have installed pysctp python module (python version: 3.5.2, Ubuntu :16.04). But when I am trying to import it I am getting importError as:
ImportError: /home/labuser/framework/my_env/lib/python3.5/site-packages/_sctp.cpython-35m-x86_64-linux-gnu.so: undefined symbol: PyString_FromStringAndSize
version:
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
I have already installed required dependencies: libsctp-dev, python-dev and/or python3-dev
pip install pysctp
$ python
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sctp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/labuser/framework/my_env/lib/python3.5/site-packages/sctp.py", line 55, in <module>
import _sctp
ImportError: /home/labuser/framework/my_env/lib/python3.5/site-packages/_sctp.cpython-35m-x86_64-linux-gnu.so: undefined symbol: PyString_FromStringAndSize
>>>
I think there is something wrong with the package pysctp because I got an error message when installing the package using the pip command pip install pysctp and pip3 install pysctp on Ubuntu 18.04. You may have to report the issue to them in their github repository at https://github.com/P1sec/pysctp.
Python newbie here.
I'm trying to do a scraper in Python3, but I'm having problems importing lxml on my Sierra 10.12.
Here's the process and additional info:
$ python3 --version
Python 3.5.1
$ pip3 install lxml
Requirement already satisfied: lxml in /usr/local/lib/python3.6/site-packages
$ python3
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'lxml'
>>>
Am I doing something wrong? Is there any other way to install a module?
I noticed that lxml seems to be installed on python 3.6 folder, even though my python3 version is 3.5.1, is that what's wrong?
EDIT: I tried the same thing with python 2.7 and got the same result.
$ python --version
Python 2.7.10
$ pip install lxml
Requirement already satisfied: lxml in /usr/local/lib/python2.7/site-packages
$ python2.7
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'lxml'
>>>