rebane2001 / matterport-dl

A downloader for matterport virtual tours
The Unlicense
294 stars 75 forks source link

cannot import name 'Mapping' #26

Closed josvanr closed 2 years ago

josvanr commented 2 years ago

Hello!

I'm trying matterport-dl on ubuntu 18.04:

python3.10 matterport-dl.py https://my.matterport.com/show/?m=Ez3YDocMaVx

but receive errors (see below). Any hints how I can get this to work?

Traceback (most recent call last): File "/sda1/matterport-dl/matterport-dl/matterport-dl.py", line 8, in import requests File "/usr/lib/python3/dist-packages/requests/init.py", line 43, in import urllib3 File "/usr/lib/python3/dist-packages/urllib3/init.py", line 8, in from .connectionpool import ( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 29, in from .connection import ( File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 40, in from .util.ssl_ import ( File "/usr/lib/python3/dist-packages/urllib3/util/init.py", line 3, in from .connection import is_connection_dropped File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 3, in from .wait import wait_for_read File "/usr/lib/python3/dist-packages/urllib3/util/wait.py", line 1, in from .selectors import ( File "/usr/lib/python3/dist-packages/urllib3/util/selectors.py", line 14, in from collections import namedtuple, Mapping ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/init.py)


mitchcapper commented 2 years ago

This is too new of a python version. It is related to 3.10 changes: https://stackoverflow.com/questions/69381312/in-vs-code-importerror-cannot-import-name-mapping-from-collections

we will have to look at the exact code changes to make it compat with 3.10 but if you use 3.9.0 you will be fine.

josvanr commented 2 years ago

Thnx, that worked!

mitchcapper commented 2 years ago

you can actually leave it open so we have on the list to fix it for 3.10.

rebane2001 commented 2 years ago

I think we should also fix it for older versions, this can be done with a simple try/except fallback

josvanr commented 2 years ago

ok ! Hmm how is your experience with programming in python anyway, with all the many version changes and what not (off topic I know ;)

On Fri, Dec 24, 2021 at 9:14 AM Jasper Rebane @.***> wrote:

I think we should also fix it for older versions, this can be done with a simple try/except fallback

— Reply to this email directly, view it on GitHub https://github.com/rebane2001/matterport-dl/issues/26#issuecomment-1000716437, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIOCWWK757EHOTSMLMU7LWTUSQTWZANCNFSM5KVTYGLQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.***>

rebane2001 commented 2 years ago

Please avoid off-topic conversations in GitHub issues as it notifies (sends e-mail to) many people; even those who haven't commented on this issue. Anyways, to answer your question, I probably started using Python in one of the earlier 3.x versions and have seen many cool and/or breaking changes being added (most notably, 3.6 and f-strings).

josvanr commented 2 years ago

ok thnx! Well, I look forward to trying out/using your script!

Jos

On Fri, Dec 24, 2021 at 4:29 PM Jasper Rebane @.***> wrote:

Please avoid off-topic conversations in GitHub issues as it notifies (sends e-mail to) many people; even those who haven't commented on this issue. Anyways, to answer your question, I probably started using Python in one of the earlier 3.x versions and have seen many cool and/or breaking changes being added (most notably, 3.6 and f-strings).

— Reply to this email directly, view it on GitHub https://github.com/rebane2001/matterport-dl/issues/26#issuecomment-1000875595, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIOCWWJMQOKHMXK7EXG2WPLUSSGU7ANCNFSM5KVTYGLQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.***>

mitchcapper commented 2 years ago

so we don't import this, @josvanr you updated your python but im guessing not your libraries. Try updating your urllib3 library: pip install urllib3 --upgrade

I think this can be closed as we don't ever call import on collections.

rebane2001 commented 2 years ago

Upgrading requests and urllib3 fixes the issue for me. It seems like python3.10/11 is quite a pickle to work with anyways, here's how I got it to work for reference:

# Get rid of outdated pip
sudo apt-get remove -y python3-pip
# Assuming you have the deadsnakes PPA, install distutils
sudo apt-get install python3.10-distutils
# Update setuptools to fix pip installer
git clone https://github.com/pypa/setuptools.git && cd setuptools && sudo python3.10 setup.py install
# Install latest pip from pypa.io
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
# Upgrade requests and urllib3
python3.10 -m pip install requests -U
python3.10 -m pip install urllib3 -U

Closing this as the issue does not seem to affect the project itself, only the widely used dependencies that should be fixed anyways no matter what you are running.