#๐ Import module error in Kaggle notebook
66 messages ยท Page 1 of 1 (latest)
@unique monolith
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
@unique monolith just looking at the next import down, have you tried mne.connectivity ? PyPI distibutions (which is what you installed) can install packages under different names, indeed they can install multiple packages.
is the pip install statement fine
i need to change the import statement it to from mne.connectivity?
Yes.
Maybe. I've not used it. Start here: https://pypi.org/project/mne-connectivity/
That page has a link to the docs. Which link to this instakation page: https://mne.tools/mne-connectivity/stable/install.html
which suggests you have the correct import already and something else isn't right.
What does curl https://pypi.org/simple/mne-connectivity/ return?
Oh. The install failed.
ill run it
What version of Python are you using? Maybe you need an older one.
im using Kaggle
This error:
ERROR: Could not find a version that satisfies the requirement mne-connectivity (from versions: none)
ERROR: No matching distribution found for mne-connectivity
Means it couldn't find something to install for you. Hence it's not there.
This can be python dependent.
so what can i do
We need to know what Python you're running, and on what platform. I don't know what Kaggle is.
Try adding this after line 4 (before you try the import):
import sys
print(sys.platform)
print(sys.version)
In fact, if Kaggle has some kind of interactive mode, just do those statements there.
That looks fine. Recent but not cutting edge.
I just read your errors properly.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7a055f3587f0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/mne-connectivity/
This says that it couldn't talk to PyPI at all. This isn't a version problem, it's a network problem. pip can't look up pypi.org by the looks of it. Can you pip install anything else. Eg requests (to pick a common package name).
wait let me connect to another network
this right: ```$ python -m pip install requests
Looks likely. Is that on Kaggle? I thought Kaggle ran things on their servers?
i got it from PyPi
Ah, so you don't, personally, have a $ CLI prompt?
imma just do !pip install requests
ok i got it
requests is installing properly
Aye. Do that. I believe that's howyou install things in a Kaggle Notebook.
Ok. Then go and do !pip install -U men-connectivity again.
Why do i need to -U
You don't. It just means "upgrade", for if it's already installed. Leave it out.
and its from mne_connectivity right?
Sorry, mne-connectivity, not men-connectivity
pip install wants the dash (-). import wants an underscore (_).
k
its saying this:
Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (2.32.3)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests) (3.4.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests) (2.3.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests) (2025.1.31)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x781315fe0790>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/mne-connectivity/
Wow. That's... weird.
It should be talking to the same servers you got requests from.
So this is from
!pip install mne-connectivity
?
yea
thats what i did
that means its not an internet problem
i think i need to use a proxy or vpn or something
It's very strange.
I did it here (a Mac) and it fetched:
https://files.pythonhosted.org/packages/80/8e/e3e7de62143236712c359db50c6bd6486557b1c5efb7d45682b8efc0a6a6/mne-1.9.0-py3-none-any.whl
That's the same server everything else should come from.
If requests installed, mne-connectivity should have installed.
Let's try something else, a package you're unlikely to have installed before (in case that's an issue):
!pip install icontract
i got this at the end also this time:
ERROR: Could not find a version that satisfies the requirement mne-connectivity (from versions: none)
ERROR: No matching distribution found for mne-connectivity
That's talking about mne-connectivity, not icontract
btw, this is why you shouldn't ask "has anyone used Kaggle": this isnt really about Kaggle.
wait i think i found the issue
Something is using /simple/icontract as a url
I FIXED IT!!!
what was the problem?
wasnt connected to the internet on Kaggle
it was a Kaggle error
i needed to verify my phone so I can turn on internet
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.