I recently installed wget, both from https://eternallybored.org/misc/wget/ and also using
pip install wget
I put the wget.exe file in C:\Windows\System32, and when I type
wget -h
into the command line, it runs perfectly fine, and returns the help list for wget. However, when I run wget from jupyter notebooks using the code below,
!wget https://raw.githubusercontent.com/MicrosoftDocs/mslearn-introduction-to-machine-learning/main/Data/ml-basics/grades.csv
df_students = pd.read_csv('https://raw.githubusercontent.com/MicrosoftDocs/mslearn-introduction-to-machine-learning/main/Data/ml-basics/grades.csv',delimiter=',',header='infer')
df_students.head()
I get: 'wget' is not recognized as an internal or external command, operable program or batch file.
I have done quite some research now and none of the solutions seem to be working for me. I have a slight suspicion it might have to do with my system PATH variables but I can't seem to understand why Jupyter Notebooks cannot find wget.
Use curl instead:
!curl https://raw.githubusercontent.com/MicrosoftDocs/mslearn-introduction-to-machine-learning/main/Data/ml-basics/grades.csv
df_students = pd.read_csv('https://raw.githubusercontent.com/MicrosoftDocs/mslearn-introduction-to-machine-learning/main/Data/ml-basics/grades.csv',delimiter=',',header='infer')
df_students.head()
The Output:
Name,StudyHours,Grade
Dan,10,50
Joann,11.5,50
Pedro,9,47
Rosie,16,9
.....
Related
I am writing this code in my jupyter notebook but it is not working.
!tail -n 10 Customers.csv
The error is
'tail' is not recognized as an internal or external command,
operable program or batch file.
I am also attaching an image for the reference.
enter image description here
I installed sed, awk, grep, tar, wget exc.. from here: http://gnuwin32.sourceforge.net/packages.html .
and I installed tail, chmod, mkdir exc.. commands from here: http://gnuwin32.sourceforge.net/packages/coreutils.htm
I tested, commands are running in jupyter notebook under windows OS but there is a mini problem: For example After running the sed command, it leaves a file with a name starting with sed, ( it is like sed_fdgdfgdf ) it is necessary to delete these files.
NOTE: Download complete package and run *.exe file
This post recommends installing WSL or Git Bash.
I am trying to download github dataset from here:
https://raw.githubusercontent.com/heyunh2015/PARADE_dataset/main/PARADE_test.txt
using a windows machine, and the anaconda host to play jupyter notebook, I am trying to directly download it in the machine using the following command:
!wget https://raw.githubusercontent.com/heyunh2015/PARADE_dataset/main/PARADE_test.txt
However, it is giving me the following error:
'wget' is not recognized as an internal or external command, operable
program or batch file.
Then I tried again after the following command:
!pip install wget
still the same error.
Next, I tried curl, and the error went away, but I am unable to access my downloaded file either through code (the file doesn't exist) or using GUI (doesn't show up in the current working directory).
What to do?
I got my answer.
import wget
url = "<source>"
wget.download(url, '<destination>')
wget not working in annaconda jupyter notebook - Windows. Alternative?
python's standard library has function for downloading files, called urlretrieve inside urllib.request. Simple usage example
import urllib.request
urllib.request.urlretrieve("https://raw.githubusercontent.com/heyunh2015/PARADE_dataset/main/PARADE_test.txt","PARADE_test.txt")
Explanation: 2 arguments are provided, URL and filename. Note that in this form this does not report progress. You need to wait until it finishes. If you must have see linked docs for discussion of 3rd argument to urllib.request.urlretrieve
I have downloaded a python package called CAMeL tools for Arabic NLP and now I have to install its data packages. It says to run the command
camel_data full
but I'm not sure how to do it. Should I just use
py camel_data full
? When I do this, it gives me
C:\Users\delar\AppData\Local\Programs\Python\Python39\python.exe: can't open file 'C:\Users\delar\AppData\Local\Programs\Python\Python39\Lib\site-packages\camel_data': [Errno 2] No such file or directory
and when I do not use py and just write camel_data full in the command prompt, it says
'camel_data' is not recognized as an internal or external command,
operable program or batch file.
try camel_data light or camel_data full without invoking python or py
I have never used this in my life and I simply did:
pip install camel-tools
Then once it was done installing I did:
camel_data full
And that worked.
You can also check the documentation on how to install the data from here: https://camel-tools.readthedocs.io/en/latest/getting_started.html
I am trying to get some open source software working. It uses things that I don't have on my system (pytorch for example) and so I thought that I could try to run it on Google Colab.
When I tried to do it though, there are some python scripts that I have to run after cloning a directory from a github repository. I guess I can't run another python script from inside a Jupyter Notebook, and so I suppose that I'm trying to do something with Colab that it isn't designed to do?
Is there something available that is more like a terminal, but using the software, GPUs etc. that are available on Colab?
You can run any shell command from jupyter-like environment (which includes colab) using ! in code cell, for example
!ls
Would list all files in colab's cwd.
To run python script you could do:
!python script.py
It works just like terminal (it might be python3, not sure how it's setup un colab)
You can call your script too.
!python script.py
But you need to put the script there, probably by git clone or direct uploading.
As Wayne mentions in the comment korakot's answer, you can use the magic command
%run 'script.py'
This also allows you to do e.g. run in the notebook's namespace by using the -i parameter
%run -i 'script.py'
I am trying to get the ipynb running on my Mac, but I am running into some trouble. I specifically want to run the ipynb that comes with Anaconda.
This question is very close to helping me but I am not sure what to do with the results from checking which python, which python2.7, which ipython.
When I type 'ipython' into the terminal, I get
/bin/bash: /Users/me/anaconda/bin/python.app: No such file or directory
Anaconda isn't even located in /Users/me/ so I don't know why bash is looking there when I've put /usr/local/bin/anaconda/bin at the front of my path (which I did after that post suggested I check my path variable).
$ which anaconda
/usr/local/bin/anaconda/bin/anaconda
$ which python
/usr/local/bin/anaconda/bin/python`
$ which python2.7
/usr/local/bin/anaconda/bin/python2.7
$ which ipython
/usr/local/bin/anaconda/bin/ipython
I tried this to see if it worked, because I'm guessing it is related to the problem I am having:
$ conda -h
-bash: /usr/local/bin/anaconda/bin/conda: /Users/me/anaconda/bin/python: bad interpreter: No such file or directory`
From the responses I'm getting from bash, it looks like everything is pointing to where it should be, so then why, when I type ipython or conda into the terminal, do I get those errors?
(Not sure if this is related, but some posts I've seen refer to changing the pip file to point to the version of Python I want, but I am not quite sure where to find the 'pip file'. I went looking for it wherever my pip is stored but I couldn't find a file per say.)
It is most likely looking in the wrong place. Standard installations would be in /Users/username/anaconda/bin. If you have installed it in /usr/local/bin/anaconda/bin/python you will want to be sure it is in you .bash_profile. In terminal run the following:
open .bash_proflie
Add the following:
export PATH="/usr/local/bin/anaconda/bin:$PATH"
Again the usual Path would be:
export PATH="/Users/me/anaconda/bin:$PATH"
Be sure to relaunch terminal or run "source .bash_profile"
I solved this problem by moving anaconda to root ("/")