2

When I run the following code in my kaggle notebook, i get an error.

import os,sys
sys.path.insert(0,"..")
sys.path.insert(0,"../..")
from glob import glob
import matplotlib.pyplot as plt
import numpy as np
import torch
import torchvision
import sys
import torch.nn.functional as F
import pandas as pd

This part works fine.

!pip install torchxrayvision

This produces an error. The error message is:

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 0x7f3e22307cd0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/torchxrayvision/

Strangely, in another, older kaggle notebook I can run the same code without an error. What ist the problem and how do I solve it?

Artur D
  • 41
  • 3
  • How are you running `sys.path.insert(0,"..")` before importing `sys`? – Sabito stands with Ukraine Dec 28 '20 at 13:04
  • The first half of the text of your question seems irrelevant. The posted code does not seem to be related to the error message. -- You seem to simply have connection issues or encryption issues. Are you using an old Python or an old _pip_? – sinoroc Dec 28 '20 at 15:34
  • 1
    I found the error: In the settings of the kaggle notebook, "Internet" was turned off. – Artur D Dec 28 '20 at 15:38
  • You need to answer your own question next time, a comment is not enough. Else, someone else can just do it for you, as was done here. – questionto42 May 26 '21 at 18:47

2 Answers2

2

Just turn the on switch for internet access in your notebook settings and try again;)

  • In my settings, it says: "Want more power? Access free GPU or turn on an internet connection. Get phone verified". Thus, you must register with your phone number before you can do this. And that reveals a lot of yourself: in which country you have your phone contract, and your social media accounts if they are linked with your phone number, and you could even be tracked with this. Not saying that you should not do it, it is just something to keep in mind. – questionto42 May 26 '21 at 19:46
0

An alternative is to download the notebook from Kaggle and open the notebook in Google Colab. Then you do not have to switch on the internet conection in the settings only to get the power of ! pip or ! apt.

If you need to load a Kaggle dataset into your Colab notebook:

questionto42
  • 7,175
  • 4
  • 57
  • 90