No module named 'cupy' on Google Colab
Mia Lopez
I'm working on the FastPhotoStyle project:
and I follow the steps of its tutorial:
I'm running Example 1 on Google Colab where default environment is
- CUDA 10.0
- Python 3.6
- Chainer 5.4.0
- CuPy 5.4.0
This is how I tried on Colab Notebook:
After running
!python3 demo.py --output_image_path results/example1.pngHere's the error message I got:
Traceback (most recent call last): File "demo.py", line 9, in
import process_stylization
File "/content/drive/FastPhotoStyle/process_stylization.py", line 14, in
from smooth_filter import smooth_filter
File "/content/drive/FastPhotoStyle/smooth_filter.py", line 327, in
from cupy.cuda import function
ModuleNotFoundError: No module named 'cupy'
Could someone help me with it please?
62 Answers
have you tried running the demo with python full path?
!/usr/local/lib/python3.6//bin/python3 demo.py --output_image_path or running without anaconda installation by simple install all necessary libraries
!pip install cupyor see installation instructions here
2import time
import cupy as cp
import numpy as np
s = time.time()
A = np.random.randint(10, size=(1000,1000))
C = A.transpose()
e = time.time()
print("waktu CPU:",e - s, "detik")
s = time.time()
A = cp.random.radint (10,size=(1000,1000))
C = A. transpose()
cp.cuda.Stream.null.synchronize()`enter code here`
e = time.time()
print("waktu GPU:",e - s, "detik") 1