Download from a link that requires to log in [duplicate] - python

This question already has answers here:
How can I use cookies in Python Requests?
(4 answers)
Using Kaggle Datasets in Google Colab
(13 answers)
Closed 4 years ago.
UPDATE: It looks like the link requires a log in, I updated the title.
This is a link for a particular Kaggle data file that I'm trying to download into Python (Google Colab if it makes a difference)
This is the link
https://www.kaggle.com/azathoth42/myanimelist/downloads/UserAnimeList.csv/9
Which I got from here
https://www.kaggle.com/azathoth42/myanimelist#UserAnimeList.csv
I tried using wget with the following code
!pip install wget
!wget -i https://www.kaggle.com/azathoth42/myanimelist/downloads/UserAnimeList.csv/9
Which didn't seem to work
I then tried
from urllib import request
request.urlretrieve('https://www.kaggle.com/azathoth42/myanimelist/downloads/UserAnimeList.csv/9' , 'download.zip')
The issue I now know is that it requires a log in.
Edit:
This link shows how to download Kaggle data into colab complete with an example notebook
Using kaggle datasets into Google Colab

Related

I got this error on Google Colab: couldn't connect to display ":1.0" [duplicate]

This question already has answers here:
Is there any way to use Tkinter with Google Colaboratory?
(2 answers)
How to use GUI in Google Colab?
(1 answer)
Closed 9 months ago.
This post was edited and submitted for review 9 months ago and failed to reopen the post:
Original close reason(s) were not resolved
I tried to use tkinter on Google Colab. And I got the error:
TclError: no display name and no $DISPLAY environment variable
And I tried this method in this answer: Is there any way to use Tkinter with Google Colaboratory?
But still I got an error:
TclError: couldn't connect to display ":1.0"
Here is my code:
import random
import os
from tkinter import *
import numpy as np
!apt-get install -y xvfb # Install X Virtual Frame Buffer
os.system('Xvfb :1 -screen 0 1600x1200x16 &')
os.environ['DISPLAY']=':1.0'
You guys didn't understand what is going on here...
I read the answers from How to use GUI in Google Colab? and Is there any way to use Tkinter with Google Colaboratory? and I think they are not answering my question.
Somebody asked if it is possible to use Tkinter in Google Colab in this question: Is there any way to use Tkinter with Google Colaboratory?, and the first answer asserted that adding these lines of code into the very beginning would be helpful.
!apt-get install -y xvfb
os.system('Xvfb :1 -screen 0 1600x1200x16 &')
os.environ['DISPLAY']=':1.0'
It says this will create a virtual display so that we can use Tkinter in Google Colab. I tried this and it failed. So now I am asking why it failed.
I know some answers stated that you cannot use a GUI on Google Colab. BUT there are answers saying that it is possible to create a virtual display. However after doing what they said, I still got the error I posted. So I am wondering is it really impossible to use tkinter in Colab or it is that whatever code from other answers that I used has something wrong with them and that can be fixed.
Please consider reopening this question as I think this is not a duplicated question.

Python Numpy installation sanity check error [duplicate]

This question already has answers here:
How do you fix "runtimeError: package fails to pass a sanity check" for numpy and pandas?
(9 answers)
Closed 2 years ago.
I was trying to run a block of python codes but I got this error. I installed all the necessary packages.
RuntimeError: The current Numpy installation ('D:\Program Files\Python38\lib\site-packages\numpy\init.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html
Does anyone know what is the problem?
This did the job:
pip install numpy==1.19.3
I can see it's a new error I also had it a couple of minutes ago when I just installed numpy and tensorflow through console.
https://developercommunity.visualstudio.com/solutions/1241964/view.html
Here the link, the link given actually worked. :)

Databricks error when trying to load a module using apache spark [duplicate]

This question already has answers here:
Pyspark StructType is not defined
(2 answers)
Closed 3 years ago.
I'm using a notebook within Databricks. The notebook is set up with python 3 if that helps. Everything is working fine and I can extract data from Azure Storage. However when I run:
import org.apache.spark.sql.types.StructType
I get the error message
ImportError: No module named 'org'
Does anyone know how I would go about fixing this? Is this something to do with the notebook being in python?
I've only just started using Databricks today so apologies if this is a silly question - I couldn't find anything online that helped.
I did try to run import org.py.spark.sql.types.StructType but that didn't work either.
Thanks
The problem is that you're trying to import scala libraries in a Python notebook. You need to either change to using a Scala notebook, or use the Pyspark equivalents.
Like:
from pyspark.sql.types import *

How do open python NLTK downloader [duplicate]

This question already has answers here:
How do I download NLTK data?
(15 answers)
Closed 3 years ago.
I'm trying to download all the nltk packages :
import nltk
nltk.download()
But the GUI don't open.
This is what appears instead :
NLTK Downloader
---------------------------------------------------------------------------
d) Download l) List u) Update c) Config h) Help q) Quit
---------------------------------------------------------------------------
When I type d I can see the list of available packages but I'm not offered to download them.
How can I open the GUI, or how can I download them all from the console ? Thanks.
Try
nltk.download('all')
this will download all the data and no need to download individually.

GPG.exe return error code 2 [duplicate]

This question already has answers here:
GPG Error Code 2
(4 answers)
Closed 8 years ago.
gpg.exe return a error code 2 for a particular machine. The code is working fine in other machines. Is this gpg.exe is machine dependent or do we need any separate settings for this in the machine?
my command is like this
gpg.exe --batch --output "I:\dataload\W2\QA2\PPP\S451.pgp" --recipient "***.*****#****.**.com" --encrypt "I:\dataload\W2\QA2\PPP\S451"
Look at dependencies and make sure python and all relevant packages are installed on that machine. Your machine can't find a specified file so check to see that all dependencies are met. Maybe post a little more about the error.

Categories