#๐Ÿ”’ Import module error in Kaggle notebook

66 messages ยท Page 1 of 1 (latest)

unique monolith
velvet oracleBOT
#

@unique monolith

Python help channel opened

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.

thorn palm
#

@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.

unique monolith
#

i need to change the import statement it to from mne.connectivity?

thorn palm
#

Yes.

unreal salmon
#

What does curl https://pypi.org/simple/mne-connectivity/ return?

thorn palm
#

Oh. The install failed.

thorn palm
#

What version of Python are you using? Maybe you need an older one.

unique monolith
thorn palm
# thorn palm Oh. The install failed.

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

unique monolith
#

yes

#

what about it

thorn palm
#

Means it couldn't find something to install for you. Hence it's not there.

#

This can be python dependent.

unique monolith
#

so what can i do

thorn palm
#

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.

unique monolith
#

ok

#

linux
3.10.12 (main, Nov 6 2024, 20:22:13) [GCC 11.4.0]

thorn palm
#

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).

unique monolith
#

wait let me connect to another network

unique monolith
thorn palm
#

Looks likely. Is that on Kaggle? I thought Kaggle ran things on their servers?

thorn palm
#

Ah, so you don't, personally, have a $ CLI prompt?

unique monolith
#

imma just do !pip install requests

#

ok i got it

#

requests is installing properly

thorn palm
#

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.

unique monolith
#

Why do i need to -U

thorn palm
#

You don't. It just means "upgrade", for if it's already installed. Leave it out.

unique monolith
#

and its from mne_connectivity right?

thorn palm
#

Sorry, mne-connectivity, not men-connectivity

unique monolith
#

not the '.'

#

yea

thorn palm
#

pip install wants the dash (-). import wants an underscore (_).

unique monolith
#

k

unique monolith
# thorn palm `pip install` wants the dash (`-`). `import` wants an underscore (`_`).

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/
thorn palm
#

Wow. That's... weird.

#

It should be talking to the same servers you got requests from.

#

So this is from

!pip install mne-connectivity

?

unique monolith
#

yea

#

thats what i did

#

that means its not an internet problem

#

i think i need to use a proxy or vpn or something

thorn palm
#

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
unique monolith
#

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
thorn palm
#

That's talking about mne-connectivity, not icontract

unique monolith
#

ok ill run icontract

zealous imp
#

btw, this is why you shouldn't ask "has anyone used Kaggle": this isnt really about Kaggle.

unique monolith
#

wait i think i found the issue

zealous imp
#

Something is using /simple/icontract as a url

unique monolith
#

I FIXED IT!!!

zealous imp
unique monolith
#

it was a Kaggle error

#

i needed to verify my phone so I can turn on internet

velvet oracleBOT
#
Python help channel closed for inactivity

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.