wget not recognized in Jupyter through Anaconda - python

I'm using a Jupyter notebook through Anaconda.
I have a command: ! wget https://url
I get the error:
'wget' is not recognized as an internal or external command, operable
program or batch file.
I already tried installing wget on my local Anaconda (as I expected, it doesn't work)
Thanks

wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used internet protocols. To install wget in Anaconda run:
conda install -c anaconda wget
If that doesn't work try:
conda install -c menpo wget
Anaconda should have added jupyter to your PATH automatically during the installation if you selected that option. If you did not select it, you need to do this manually by following the steps in answers to Anaconda Packages.

Related

Installing bioinformatics packages like bowtie2 in windows through WSL

I'm trying to develop a GUI in python for analyze tRNA-Seq data which could be run in Linux and Windows. For this it is needed run some programs like: bowtie2, samtools or bedtools, which can be downloaded by anaconda easily on Linux but is a headache on Windows. This programs can't be downloaded on Windows so I had to install Windows Subsystem for Linux (WSL) and tried to downloaded by this way.
I have developed the following python script (anaconda_setup.py) for doing this:
import os
#Download the file for Linux, altough this script will run only on Windows Subsystem for Linux
os.system('curl -O https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh')
#Checking the integrity of the file
os.system('sha256sum Anaconda3-2020.07-Linux-x86_64.sh')
#Running the .sh script
os.system('bash Anaconda3-2020.07-Linux-x86_64.sh')
#Compiling from source
os.system('source ~/.bashrc')
os.system('Anaconda3-2020.07-Linux-x86_64.sh')
#Using conda to install bowtie2, samtools and bedtools
os.system('conda install -c bioconda bowtie2')
os.system('conda install -c bioconda samtools')
os.system('conda install -c bioconda bedtools')
And then I use the following code in the main script for call the other script:
import os
...
os.system("wsl python3 anaconda_setup.py")
With this anaconda is installed correctly, but I'm not sure if it is installed on windows or in WSL. But I obtained the next error:
sh: 1: source: not found
sh: 1: conda: not found
sh: 1: conda: not found
sh: 1: conda: not found
On the other hand I have entered to WSL from CMD and I can run conda.exe and conda manually, but I can't do it in an automatically way. Moreover from CMD I can't run: "wsl conda" (error: /bin/bash: conda: command not found) but I can run wsl conda.exe without anyproblem.
Any idea what I'm doing wrong or how can I fix this?
Thank you very much.
Use Linux installers for anaconda to install anaconda for wsl2
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
check if conda command runs, if not, the path must be exported in .bashrc file
export PATH=/home/user/anaconda3/bin:$PATH
run conda again, it will work now. You can install your required software using conda in wsl2.
Hope this helps you out. For more info visit this
post
Here are the steps you can follow.
you have to have Ubuntu terminal installed. If not download it from Microsoft Store.
After installing Ubuntu install wget using command sudo apt install wget
Install miniconda because miniconda is lighter version of anaconda and will save up a lot of space.
Download miniconda installer.
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
Install miniconda bash Miniconda3-latest-Linux-x86_64.sh
export PATH export PATH=~/miniconda3/bin:$PATH
Install bowtie2 using bioconda channel conda install -c bioconda bowtie2

how to install pip on windows

I've tried installing pip on windows using instructions from https://www.liquidweb.com/kb/install-pip-windows/, (which I've listed below), but when I run pip -V, I keep getting 'pip' is not recognized as an internal or external command,
operable program or batch file. Does anyone know what to do?
These were the instructions I followed:
Download get-pip.py to a folder on your computer. (right clicked and selected save link as...)
Open a command prompt and navigate to the folder containing get-pip.py.
Run the following command:
python get-pip.py
Pip is now installed!
You can verify that Pip was installed correctly by opening a command prompt and entering the following command:
pip -V
I recommend you to uninstall python and then reinstall it again. In the installation window, use custom installation and check all the option which includes pip and also check to add pip to your environment variables.
In Windows 10, you need to add pip to the PATH.
This post should solve your issue: 'pip' is not recognized as an internal or external command

Jupyter command `jupyter-lab` not found

I have tried to install jupyter lab on my Kubuntu machine.
If I install jupyter lab with 'pip3 install jupyter jupyterlab' the command 'jupyter notebook' works completly fine. But if I try to run 'jupyter lab' every time I get the message:
Traceback (most recent call last):
File "/usr/local/bin/jupyter", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/jupyter_core/command.py", line 230, in main
command = _jupyter_abspath(subcommand)
File "/usr/local/lib/python3.6/dist-packages/jupyter_core/command.py", line 133, in _jupyter_abspath
'Jupyter command `{}` not found.'.format(jupyter_subcommand)
Exception: Jupyter command `jupyter-lab` not found.
What is wrong?
I tried to reinstall jupyter and jupyterlab multiple times with the same issue.
Its the space. Its always the space. Never ever use spaces within package name. Its always either namepart1-namepart2 or namepart1namepart2. This is because arguments are separated by space. So if you put space in between, it makes pip think that you want to install two different packages named jupyter and lab. Just use:
python -m pip install jupyterlab
Or simply:
pip install jupyterlab
No need to uninstall or reinstall anything. However to run jupyter lab server you might want to add spaces as follows:
jupyter lab
In my case, the only way to fix this was to add the following directory to the PATH in Linux:
/home/ubuntu/.local/bin
When installing jupyterlab, we may get warning like this:
Installing collected packages: jupyterlab
WARNING: The scripts jlpm, jupyter-lab, jupyter-labextension and jupyter-labhub are installed in '/home/tln/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed jupyterlab-3.0.14
So as per this warning, scripts like jupyter-lab will be unavailable unless added to the PATH.
Use below command to add these scripts to be able to use from command line:
tln#tln-X550LD:~$ export PATH="$HOME/.local/bin:$PATH"
That's it. This worked fine for me.
I had the same error on Windows 10. It was with pip install jupyterlab. Then after the error I uninstalled it with pip and reinstalled with "pip install jupyterlab". Everything worked flawlessly thereafter.
In your case you're using pip3. Try it as above or see if pip3 needs an update.
I had same issue. I solved it running pip install jupyterlab in prompt with admin privilegies.
Had the same issue and resolved it by installing with pip3
pip3 install jupyterlab;
jupyter lab
If you face -bash: jupyter-lab: command not found or -bash: jupyter: command not found, etc., you can look for "jupyter-lab" and enter that full path instead.
Mac:
$ /Users/mark/venv/bin/jupyter-lab
Windows:
C:\mark\venv\Scripts\jupyter-lab.exe
I got this same error every time I forgot to activate the virtualenv jupyterlab was installed into. After activating the virtualenv, all's well.
With pip
$ source [path_to_venv]/bin/activate
With pipenv
$ pipenv shell
Then, with a prompt indicating an activated shell, you can enter your command
(venv) $ jupyter lab
With conda or other more holistic python environments, you probably use their gui to activate a virtualenv with jupyter and jupyterlab installed.
Install with Anaconda
conda install -c conda-forge notebook
conda install -c conda-forge jupyter
conda install -c conda-forge jupyter_contrib_nbextensions
Once installed you just have to run
pip install jupyterlab
~/.local/bin/jupyter-lab
and ready and open browser http://localhost:8888/lab
Ubuntu 22
Lubuntu 22
well the problem is like this:
the jupyterlab module has not been packaged for debian, but the jupyterlab_server package has, named python3-jupyterlab-server.
please sudo apt install python3-jupyterlab-server.
then, as your user, run pip3 install jupyterlab, that will install it in your ~/.local/bin a few programs, the missing jupyter-lab among them.
last, but not least, run jupyter-serverextension enable --py jupyterlab.
to be able to run jupyter lab, you first need to run export PATH="/home/$(whoami)/.local/bin:"$PATH. this command will run automatically if added to your ~/.bash_profile.
ubuntu can not find the jupyter-lab because it is not in path.
in order to check the place of installment. run below command
find ~ -name jupyter-lab
possible result: /home/soshiant/.local/bin/jupyter-lab
for adding a directory to the Linux path you can follow below link:
How to add a directory to the PATH
if anyone still struggling ...
try:
find ~ -name jupyter-lab
and then:
export PATH=[path]
then try again: jupyter lab
note:
don't add any extra spaces and PATH is case sensitive and if u still struggling just try to install any missing pkgs after hosting to the main path by opining another tab or changing the path to main.
and then host to localhost:8888/lab
that should works fine...
I was using conda to install
conda install -c conda-forge jupyterlab
and this error came about.
I simply used this command to get it to run.
pip install jupyterlab
In my ubuntu installation this was qused by not using sudo before the install.
sudo pip install jupyterlab
If you already installed jupyterlab, and it dit not work, you can install again using sudo, you dont need to remove the old version first for it to work

pip configuration go wrong after ubuntu restart

after restart my ubuntu 16.04, could not find pip
I can only get my original pip via python3 -m pip freeze
if I use pip freeze there shows bash: /usr/bin/pip: No such file or directory
And I installed my jupyter via pip install and I could not use jupyter notebook command now. It shows jupyter: command not found
And I make sure I use sudo apt-get update and when I want to install a new jupyter with sudo apt-get install jupyter-notebook it shows
E: Unable to locate package jupyter-notebook
Seems several system configuration go wrong? How to recover these? How can I open my jupyter?
bash: /usr/bin/pip: No such file or directory
Verify the file /usr/bin/pip exists. If it does check the first line:
head -1 /usr/bin/pip
The line (called shebang) must be something like #!/usr/bin/python. If it isn't edit the file and fix the shebang line to point to an existing python binary.
I installed my jupyter via pip install and I could not use jupyter notebook command now. It shows jupyter: command not found
It's because pip installed jupyter into a directory not in $PATH. Most probably /usr/local/bin/. Check the directory with pip show --files jupyter and add the directory to your $PATH both in the current shell and in your ~/.bash_profile.
I want to install a new jupyter with sudo apt-get install jupyter-notebook it shows E: Unable to locate package jupyter-notebook
Try sudo apt-get update.
The pip problem has been solved.
The reason is that PATH is somehow modified and it loses the ~/.local/bin, the original pip is in this path and pip also install jupyter notebook in this path.
After I added ~/.local/bin to PATH I can run pip and jupyter notebook, in brief this is a path problem

Issue installing pip and pandas

I am trying to install Pandas with Pip and am running into some strange issues. Command prompt reported that pip is an unrecognized command. I thought that was strange, but decided to definitively remedy that by installing pip with the following commands:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
I received the report that an existing version of pip was found, uninstalled, and the new version was installed. I then proceeded to run
pip install pandas
And I was informed that 'pip' is not recognized as an internal or external command, operable program or batch file.
I then added to the path environment and the issue is still persisting. It's worth noting that I installed Python 3.6 by installing Anaconda. What am I missing here?
The pip command is not found because it's not in your path.
You should add the following to your PATH environment variable:
;%PYTHON_HOME%\;%PYTHON_HOME%\Scripts\
A simple Google search should help you find how to change environment variables for you version of Windows.
For example, see this page from the Java documentation.
Try the following
C:\Users\Username>cd C:\Python27\Scripts
C:\Python27\Scripts>pip freeze
If you're using a different Python version, replace Python27, with your version of Python.
On windows you can use !pip install pandas in your Python program without having to open the windows/anaconda prompt.
But as others said, pip is not in your active directory and you would have to open the anaconda prompt or go to the library where pip is installed

Categories