Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot import name 'pad' from 'skimage.util #528

Open
nightshining opened this issue Nov 22, 2022 · 7 comments
Open

cannot import name 'pad' from 'skimage.util #528

nightshining opened this issue Nov 22, 2022 · 7 comments

Comments

@nightshining
Copy link

nightshining commented Nov 22, 2022

System: Running Mac M1 13.0.1

Command being used:

first-order-model % python3 demo.py --config config/vox-256.yaml --checkpoint checkpoints/vox-cpk.pth.tar --source_image ./assets/source.png --driving_video ./assets/driving.mp4 --cpu

Result:

Traceback (most recent call last):
File "demo.py", line 15, in
from animate import normalize_kp
File "/Users/user_name/Documents/GitHub/first-order-model/animate.py", line 7, in
from frames_dataset import PairedDataset
File "/Users/user_name/Documents/GitHub/first-order-model/frames_dataset.py", line 10, in
from augmentation import AllAugmentationTransform
File "/Users/user_name/Documents/GitHub/first-order-model/augmentation.py", line 12, in
from skimage.util import pad
ImportError: cannot import name 'pad' from 'skimage.util' (/opt/miniconda3/envs/firstm/lib/python3.7/site-packages/skimage/util/init.py)

@byronbonkers
Copy link

did u fix it?

@nightshining
Copy link
Author

Hi, here is the full list of packages in my conda environment. You need the version of scikit-image listed in the packages below.

ca-certificates           2022.10.11           hecd8cb5_0  
certifi                   2022.9.24        py38hecd8cb5_0  
charset-normalizer        2.1.1                    pypi_0    pypi
contourpy                 1.0.6                    pypi_0    pypi
cycler                    0.11.0                   pypi_0    pypi
ffmpeg                    1.4                      pypi_0    pypi
fonttools                 4.38.0                   pypi_0    pypi
idna                      3.4                      pypi_0    pypi
imageio                   2.13.4                   pypi_0    pypi
imageio-ffmpeg            0.4.7                    pypi_0    pypi
joblib                    1.2.0                    pypi_0    pypi
kiwisolver                1.4.4                    pypi_0    pypi
libcxx                    14.0.6               h9765a3e_0  
libffi                    3.3                  hb1e8313_2  
matplotlib                3.6.2                    pypi_0    pypi
ncurses                   6.3                  hca72f7f_3  
networkx                  2.8.8                    pypi_0    pypi
numpy                     1.23.5                   pypi_0    pypi
openssl                   1.1.1s               hca72f7f_0  
packaging                 21.3                     pypi_0    pypi
pandas                    1.5.1                    pypi_0    pypi
pillow                    9.3.0                    pypi_0    pypi
pip                       22.2.2           py38hecd8cb5_0  
pyparsing                 3.0.9                    pypi_0    pypi
python                    3.8.15               h4319210_0  
python-dateutil           2.8.2                    pypi_0    pypi
pytz                      2022.6                   pypi_0    pypi
pywavelets                1.4.1                    pypi_0    pypi
pyyaml                    6.0                      pypi_0    pypi
readline                  8.2                  hca72f7f_0  
requests                  2.28.1                   pypi_0    pypi
**scikit-image              0.18.3                   pypi_0    pypi**
scikit-learn              1.1.3                    pypi_0    pypi
scipy                     1.9.3                    pypi_0    pypi
setuptools                65.5.0           py38hecd8cb5_0  
six                       1.16.0                   pypi_0    pypi
sqlite                    3.40.0               h880c91c_0  
threadpoolctl             3.1.0                    pypi_0    pypi
tifffile                  2022.10.10               pypi_0    pypi
tk                        8.6.12               h5d9f67b_0  
torch                     1.13.0                   pypi_0    pypi
torchvision               0.14.0                   pypi_0    pypi
tqdm                      4.64.1                   pypi_0    pypi
typing-extensions         4.4.0                    pypi_0    pypi
urllib3                   1.26.12                  pypi_0    pypi
wheel                     0.37.1             pyhd3eb1b0_0  
xz                        5.2.6                hca72f7f_0  
zlib                      1.2.13               h4dc903c_0  

@franfifa101
Copy link

franfifa101 commented Nov 28, 2022 via email

@sunyuxiu
Copy link

Because there is no attirbute of pad in skimge if the version of skimage is more than 0.19.0.But it is ok in version of 0.18.0 in skimage.So you should switch the version of skimage into 0.18.0 and you could use it normally.

@paulreichling
Copy link

Can someone explain in more detail how I'd apply this set of plugins to the collab model in order to get it working?

@ckot
Copy link

ckot commented Mar 5, 2023

According to https://discuss.scientific-python.org/t/from-skimage-util-import-pad/308 , skimage.utils.pad has been deprecated for quite some time in favor of the same function from numpy and finally got removed in v 19.0.

I encountered this issue when using a google colab which cloned this repo and imported demo. The notebook worked last weekend but not today, and neither the notebook nor this repo have changed. I'm under the assumption that something in the environment has changed - probably some dep in colabs dist-packages got updated.

Prepending a !pip list cell to the notebook revealed that scikit-image v19.4.0 (which doesn't contain pad) is indeed installed. I can only assume that that wasn't the case last weekend.

Perhaps the contents of this repo wstill work in other environments, but I'm guessing that folks trying to use it in colab will have the same issue as myself/others.

Unfortunately, several dep versions in requirements.txt are no longer available. I'm not familiar enough with them to know if any APIs have changed, and thus how much work is required to update this repo to work with more up-to-date versions of the deps, so I'll have to leave it up to someone else to create a PR.

@graphemecluster
Copy link
Contributor

@AliaksandrSiarohin Fixed by #565.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants