wtomin/MIMAMO-Net

Syntax Error when run_example.py is ran

chan-kh opened this issue · 2 comments

I was trying to follow the MIMAMO-Net api Getting started document. An syntax error occurred when I was trying to run the run_example.py

The log is the following:

`(myenv) ubuntu@ip-172-31-33-255:~/MIMAMO-Net/api$ python run_example.py
Traceback (most recent call last):
  File "run_example.py", line 2, in <module>
    from tester import Tester
  File "/home/ubuntu/MIMAMO-Net/api/tester.py", line 3, in <module>
    from resnet50_extractor import Resnet50_Extractor
  File "/home/ubuntu/MIMAMO-Net/api/resnet50_extractor.py", line 70
    ims = ims.cuda(async=True)
                   ^
SyntaxError: invalid syntax`

I think I have followed every steps listed in the document. However, there is an issue when I was trying to install the independencey for Installing libraries and packages used to read various image formats from disk. In particular, the command

sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev

I believe the installation is incompleted and the log is :

`(myenv) ubuntu@ip-172-31-33-255:~/MIMAMO-Net/api$ sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev #  Install libraries and packages used to read various image formats from disk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libpng12-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Unable to locate package libjasper-dev
E: Package 'libpng12-dev' has no installation candidate`

refer to this: pytorch/pytorch#3431

the parameter name async is renamed to non_blocking in 2018, due to python3.7 updates occupying the keyword async. We have to update our code if we are using python 3.7+ and latest version of pytorch.

@wtomin interested to know what version of python and pytorch you are using, so that we can replicate your environment.

Sorry for my late reply. If you followed my instruction, I think the installed pytorch version is 1.4.0, cuda version is 10.1. Python version is 3.6.10.

Here is the print out of installed softwares:

$ conda list
# packages in environment at /home/nisl/anaconda3/envs/MIMAMO_test:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
blas                      1.0                         mkl  
ca-certificates           2020.1.1                      0  
certifi                   2020.4.5.1               py36_0  
cudatoolkit               10.1.243             h6bb024c_0  
cycler                    0.10.0                   pypi_0    pypi
freetype                  2.9.1                h8a8886c_1  
intel-openmp              2020.0                      166  
jpeg                      9b                   h024ee3a_2  
kiwisolver                1.2.0                    pypi_0    pypi
ld_impl_linux-64          2.33.1               h53a641e_7  
libedit                   3.1.20181209         hc058e9b_0  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 9.1.0                hdf63c60_0  
libgfortran-ng            7.3.0                hdf63c60_0  
libpng                    1.6.37               hbc83047_0  
libstdcxx-ng              9.1.0                hdf63c60_0  
libtiff                   4.1.0                h2733197_0  
matplotlib                3.0.3                    pypi_0    pypi
mkl                       2020.0                      166  
mkl-service               2.3.0            py36he904b0f_0  
mkl_fft                   1.0.15           py36ha843d7b_0  
mkl_random                1.1.0            py36hd6b4f25_0  
ncurses                   6.2                  he6710b0_0  
ninja                     1.9.0            py36hfd86e86_0  
numpy                     1.18.1           py36h4f9e942_0  
numpy-base                1.18.1           py36hde5b4d6_1  
olefile                   0.46                     py36_0  
openssl                   1.1.1f               h7b6447c_0  
pandas                    1.0.3                    pypi_0    pypi
pillow                    7.0.0            py36hb39fc2d_0  
pip                       20.0.2                   py36_1  
pyparsing                 2.4.7                    pypi_0    pypi
python                    3.6.10               hcf32534_1  
python-dateutil           2.8.1                    pypi_0    pypi
pytorch                   1.4.0           py3.6_cuda10.1.243_cudnn7.6.3_0    pytorch
pytz                      2019.3                   pypi_0    pypi
readline                  8.0                  h7b6447c_0  
setuptools                46.1.3                   py36_0  
six                       1.14.0                   py36_0  
sqlite                    3.31.1               h7b6447c_0  
tk                        8.6.8                hbc83047_0  
torchvision               0.5.0                py36_cu101    pytorch
tqdm                      4.45.0                   pypi_0    pypi
wheel                     0.34.2                   py36_0  
xz                        5.2.5                h7b6447c_0  
zlib                      1.2.11               h7b6447c_3  
zstd                      1.3.7                h0b5b093_0