0

gcp I create a compute instance on gcp, installed conda, created a virtual environment.

But when I try to install any library with pip, nothing is working.

Even outside conda environment, the pip install is not working. It shows no error but no library can be imported.

...
Proceed ([y]/n)? y
...

Downloading and Extracting Packages
readline-8.1         | 362 KB    | ##################################################################### | 100% 
ncurses-6.2          | 817 KB    | ##################################################################### | 100% 
_openmp_mutex-4.5    | 22 KB     | ##################################################################### | 100% 
libgomp-9.3.0        | 311 KB    | ##################################################################### | 100% 
certifi-2021.5.30    | 139 KB    | ##################################################################### | 100% 
ca-certificates-2021 | 113 KB    | ##################################################################### | 100% 
ld_impl_linux-64-2.3 | 586 KB    | ##################################################################### | 100% 
libgcc-ng-9.3.0      | 4.8 MB    | ##################################################################### | 100% 
xz-5.2.5             | 341 KB    | ##################################################################### | 100% 
pip-21.0.1           | 1.8 MB    | ##################################################################### | 100% 
setuptools-52.0.0    | 710 KB    | ##################################################################### | 100% 
python-3.7.11        | 45.3 MB   | ##################################################################### | 100% 
sqlite-3.36.0        | 990 KB    | ##################################################################### | 100% 
openssl-1.1.1k       | 2.5 MB    | ##################################################################### | 100% 
libstdcxx-ng-9.3.0   | 3.1 MB    | ##################################################################### | 100% 
tk-8.6.10            | 3.0 MB    | ##################################################################### | 100% 
libffi-3.3           | 50 KB     | ##################################################################### | 100% 
wheel-0.37.0         | 32 KB     | ##################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate face
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) zabiralnabil@face-test:~/Emotion-Investigator$ conda activate face
(face) zabiralnabil@face-test:~/Emotion-Investigator$ pip install -r requirements.txt
Collecting Flask==1.1.2
  Using cached Flask-1.1.2-py2.py3-none-any.whl (94 kB)
Collecting Keras-Preprocessing==1.1.0
  Using cached Keras_Preprocessing-1.1.0-py2.py3-none-any.whl (41 kB)
Collecting matplotlib==3.3.3
  Using cached matplotlib-3.3.3-cp37-cp37m-manylinux1_x86_64.whl (11.6 MB)
Collecting opencv-python==4.4.0.46
  Using cached opencv_python-4.4.0.46-cp37-cp37m-manylinux2014_x86_64.whl (49.5 MB)
Collecting pandas==1.1.5
  Using cached pandas-1.1.5-cp37-cp37m-manylinux1_x86_64.whl (9.5 MB)
Collecting Pillow>=8.0.1
  Using cached Pillow-8.3.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (3.0 MB)
Collecting tensorflow>=2.3.0
  Downloading tensorflow-2.6.0-cp37-cp37m-manylinux2010_x86_64.whl (458.3 MB)
     |████████████████████████████████| 458.3 MB 475 kB/s eta 0:00:01Killed
(face) zabiralnabil@face-test:~/Emotion-Investigator$ python
Python 3.7.11 (default, Jul 27 2021, 14:32:16) 
[GCC 7.5.0] :: Anaconda, Inc. 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'
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pandas'
>>> 

I'm using the conda version of pip and python.

(face) zabiralnabil@face-test:~/Emotion-Investigator$ which pip
/home/zabiralnabil/anaconda3/envs/face/bin/pip
(face) zabiralnabil@face-test:~/Emotion-Investigator$ which pip3
/home/zabiralnabil/anaconda3/envs/face/bin/pip3
(face) zabiralnabil@face-test:~/Emotion-Investigator$ which python
/home/zabiralnabil/anaconda3/envs/face/bin/python
(face) zabiralnabil@face-test:~/Emotion-Investigator$ which python3
/home/zabiralnabil/anaconda3/envs/face/bin/python3
(face) zabiralnabil@face-test:~/Emotion-Investigator$
Zabir Al Nazi
  • 10,298
  • 4
  • 33
  • 60
  • You probably have either a collision of different pip installations or you are using the wrong pip version (pip versus pip3). Use the command **which** to determine if you are using the OS installed version of pip or the Conda version: :**which -a pip**. Check if your system has both Python2 pip and Python3 pip which is named pip3: **which -a pip3**. – John Hanley Aug 22 '21 at 20:13
  • Hi, thanks for the suggestion. I checked that already. I am using pip and python from conda. – Zabir Al Nazi Aug 22 '21 at 20:15
  • You do not show the command that generates the output. Which pip are you using (pip or pip3). For Python 2x, use pip. For Python 3.x use pip3. – John Hanley Aug 22 '21 at 20:16
  • I have tried `pip, pip3, python -m pip, python3 -m pip`, all possible commands. – Zabir Al Nazi Aug 22 '21 at 20:20
  • Well, when I tried `python3.7 -m pip` it seems to work. Why is that? In my conda environment, the default python should be 3.7. – Zabir Al Nazi Aug 22 '21 at 20:23
  • 1
    I do not know as I have not used Conda for a couple of years. At least you have a clue to investigate. – John Hanley Aug 22 '21 at 20:24
  • Does your machine have a public IP? – guillaume blaquiere Aug 23 '21 at 07:31

0 Answers0