1
votes

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?

2
How are you running sys.path.insert(0,"..") before importing sys?Sabito 錆兎
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
I found the error: In the settings of the kaggle notebook, "Internet" was turned off.Artur D
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

2 Answers

0
votes

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: