Installing Jupyter Notebook using pip in Ubuntu 14.04 - python

I am trying to install jupyter notebook but for some reasons I am not able to install it. I have looked into several links like this and this but it did not help me. I am guessing the problem here is with the installation of pip. When I check the version of pip I get the following result :
shaloin#shaolin-Inspiron-3543:~$ pip --version
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
But when I try to upgrade the version of pip, I am getting this error :
shaloin#shaolin-Inspiron-3543:~$ sudo pip install --upgrade pip
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pip in /usr/lib/python2.7/dist-packages
Downloading/unpacking pip
Cleaning up...
No distributions at all found for pip in /usr/lib/python2.7/dist-packages
Storing debug log for failure in /home/shaloin/.pip/pip.log
So, I searched for the error and I got to know that if you are behind proxy you should try out the following command :
sudo pip --proxy [NITS:abcde#]172.16.30.20:8080 install jupyter
where NITS is the usename abcde is the password , proxy server = 172.16.30.20 and password=8080, after which I got the following error :
Downloading/unpacking jupyter
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1178, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 194, in find_requirement
page = self._get_page(main_index_url, req)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_page
session=self.session,
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 670, in get_page
resp = session.get(url, headers={"Accept": "text/html"})
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 467, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 237, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 455, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 558, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/adapters.py", line 305, in send
conn = self.get_connection(request.url, proxies)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/adapters.py", line 206, in get_connection
except_on_missing_scheme(proxy)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/utils.py", line 636, in except_on_missing_scheme
raise MissingSchema('Proxy URLs must have explicit schemes.')
MissingSchema: Proxy URLs must have explicit schemes.
Storing debug log for failure in /home/shaloin/.pip/pip.log
I also tried setting up my proxy in this way :
set http_proxy=http://username:password#proxyAddress:port
set https_proxy=https://username:password#proxyAddress:port
but none of that works for installing jupyter notebook using pip.
Please don't mark this question as duplicate as because I have been searching for the solution for a long time and none of them works.
Can anyone please help??

For Ubuntu 14.04
I solved the problem of installation using anaconda. The description is given in this link.I couldn't fix the problem of upgrading pip. The steps for installing jupyter notebook is given below :
Step 1 (refer here)
First we install anaconda using wget
32 bits version
wget
https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.3.0-Linux-x86.sh
64 bits version
wget
https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.3.0-Linux-x86_64.sh
Step 2
After the download is over :
32 bits version
bash Anaconda-2.3.0-Linux-x86.sh
64 bits version
bash Anaconda-2.3.0-Linux-x86_64.sh
After downloading anaconda, open your terminal and type the following command :
$ sudo gedit ~/.profile
Add the given line at th end of the file :
export PATH=~/anaconda2/bin:$PATH
Step 3
After adding the line save the file. Open a new terminal and go to the directory where anaconda was downloaded.
$ cd anaconda2/bin
~/anaconda2/bin$ source activate
(root):~/anaconda2/bin$ jupyter notebook
The jupyter notebook will be opened in the browser.
For more information on jupyter notebook you can refer to this link.

Related

How do I fix this error (unable to find resource t32.exe) that I get when I try to upgrade pip on Windows 10?

I am getting the following error:
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
status = self.run(options, args)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\commands\install.py", line 395, in run
installed = install_given_reqs(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\req\__init__.py", line 67, in install_given_reqs
requirement.install(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\req\req_install.py", line 809, in install
install_wheel(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\install\wheel.py", line 607, in install_wheel
install_unpacked_wheel(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\install\wheel.py", line 548, in install_unpacked_wheel
generated_console_scripts = maker.make_multiple(scripts_to_generate)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 415, in make_multiple
filenames.extend(self.make(specification, options))
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\install\wheel.py", line 280, in make
return super(PipScriptMaker, self).make(specification, options)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 404, in make
self._make_script(entry, filenames, options=options)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 304, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 239, in _write_script
launcher = self._get_launcher('t')
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 383, in _get_launcher
raise ValueError(msg)
ValueError: Unable to find resource t32.exe in package pip._vendor.distlib
Please take a look!
This one worked perfectly for me without any additional installations or 3rd party scripts:
python -m pip uninstall pip
python -m ensurepip
python -m pip install -U pip
TRY THIS:
uninstall current pip:
python -m pip uninstall pip setuptools
download get-pip.py from https://bootstrap.pypa.io/get-pip.py
execute get-pip script:
python get-pip.py
Don't forget to mark answer correct if you find it helpful.
Thanks
This worked for me. I visited this page and searched for the missing resource "t32.exe".
Scroll down the page and complete the capture, and click on download. t32.exe file download.
Before you download, make sure your antivirus is on to avoid any problems after the download.
After downloading, go to the directory
C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip_vendor\distlib\
Now copy and paste the downloaded t32.exe file and paste it into the directory and save it. Now run python -m pip install -–upgrade pip again.

pip throws TypeError: parse() got an unexpected keyword argument 'transport_encoding' when trying to install new packages

I am using the latest version of Anaconda3. I just installed it and I am trying to download some packages. I am using the Anaconda Prompt. While trying to use pip to do anything (including upgrading existing packages) I get the following traceback.
Exception:
Traceback (most recent call last):
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\req\req_set.py", line 487, in _prepare_file
req_to_install, finder)
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\req\req_set.py", line 428, in _check_skip_installed
req_to_install, upgrade_allowed)
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 811, in get_page
inst = cls(resp.content, resp.url, resp.headers)
File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 731, in __init__
namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'
Any ideas? (this problem only started after I installed tensorflow) Thanks.
I had the same problem and what worked for me was updating pip with conda:
conda install pip
It changed my pip from 9.0.1-py36hadba87b_3 to 9.0.1-py36h226ae91_4 and solved issue.
download https://github.com/html5lib/html5lib-python/tree/master/html5lib and overwrite all the files within html5lib folder in your tensorflow environment
"envs\tensorflow\Lib\site-packages\html5lib"
Then you should be able to run any "pip install" commands after that
I ran into the same problem while installing keras (after I installed tensorflow 1.3 using pip) on the latest version of Anaconda 3. I was able to fix the problem by installing keras using conda conda install -c conda-forge keras
I was getting this exact error installing SerpentAI. All I did to fix it was run activate serpent in conda prompt and then I ran the command again. Not sure if it's applicable to your situation, but they seem close enough that it might.
EDIT - if the above didn't work, comment out this line:
That worked perfectly for me.
(this took a helpful member of our community 8 hours to debug)
This worked for me:
python -m pip install --upgrade tensorflow
pip3 install -U html5lib=="0.9999999"
worked for me
here's the html5lib bug on github
from: https://stackoverflow.com/a/39087283
Here was the fix for me:
cd /usr/share/python-wheels/
Contents of dir:
-rwxrwxrwx 1 www-data www-data 493905 Jul 22 2015 html5lib-0.999-py2.py3-none-any.whl
-rw-r--r-- 1 root root 112620 Apr 3 2019 html5lib-0.999999999-py2.py3-none-any.whl
Run:
mv html5lib-0.999-py2.py3-none-any.whl html5lib-0.999-py2.py3-none-any.whl.bak
pip3 works fine after. Was loading the old 0.999 version.

python: How to create virtualenv without internet connection

I have trouble creating a virtualenv on a server that blocks all internet access. Has anybody successfully done that before? I searched but doesn't show up anything helpful. I have no problem transferring data back and forth, but I don't know what packages need to be downloaded and what options I need to have for the installation.
If you are curious what I got by trying to create one, here's the backtrace:
netops#netops1 /spare/local/latency $virtualenv -p /usr/bin/python2.6 latency
Running virtualenv with interpreter /usr/bin/python2.6
New python executable in latency/bin/python2.6
Also creating executable in latency/bin/python
Installing setuptools.....................
Complete output from command /spare/local/latency/latency/bin/python2.6 -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" --always-copy -U setuptools:
Downloading http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
Traceback (most recent call last):
File "<string>", line 279, in <module>
File "<string>", line 211, in main
File "<string>", line 159, in download_setuptools
File "/usr/lib64/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib64/python2.6/urllib2.py", line 1181, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib64/python2.6/urllib2.py", line 1156, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 110] Connection timed out>
Thanks for any help.
If you update virtualenv to a version >= 1.10, then it will never connect to the internet regardless of any flag (see the "Changes & News" section here)
The internet connection is used to install the setuptools and pip packages in the virtual environment. Older versions of virtualenv will try to download these two packages, while newer versions ship with them and will just unpack them when necessary.
Since your virtualenv version (1.7.2) is lower than 1.10, you can use the --never-download flag in order to avoid connecting to the internet. Later on, you can install (offline) what you need.
Here (section "The --extra-search-dir Option") it's explained how to bootstrap setuptools and pip without an internet connection. You basically need to get the .egg files for these packages and put them somewhere local, and then you need to do:
$ virtualenv --extra-search-dir=/path/to/eggs --never-download ENV
mkdir .mypypi
pip install --download $HOME/.mypypi ipython ipdb django
Now transfer the contents from .mypypi to your server. Let's say you copied it to your $HOME Then do this:
pip install --no-index --find-links=file:/$HOME/.mypypi ipython
This should work for requirements.txt file too.

Pip install from requirements file is failing, but installing one by one works

I am trying to install a bunch of python dependencies using a requirements.txt file with the following command:
pip install -r requirements.txt
The requirements.txt file has the following packages:
pep8
selenium
paramiko
soappy
nose
wmi
mock
python-keystoneclient
python-novaclient
python-cinderclient
python-swiftclient
python-glanceclient
python-heatclient
python-neutronclient
But when running the pip install command I am getting this error:
Downloading/unpacking PrettyTable>=0.7,<0.8 (from python-keystoneclient->-r requ
irements.txt (line 9))
Cleaning up...
Exception:
Traceback (most recent call last):
File "C:\Python27\VirtualEnvs\test\lib\site-packages\pip\basecommand.py", line
122, in main
status = self.run(options, args)
File "C:\Python27\VirtualEnvs\test\lib\site-packages\pip\commands\install.py",
line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundl
e=self.bundle)
File "C:\Python27\VirtualEnvs\test\lib\site-packages\pip\req.py", line 1197, i
n prepare_files
do_download,
File "C:\Python27\VirtualEnvs\test\lib\site-packages\pip\req.py", line 1375, i
n unpack_url
self.session,
File "C:\Python27\VirtualEnvs\test\lib\site-packages\pip\download.py", line 54
6, in unpack_http_url
resp = session.get(target_url, stream=True)
File "C:\Python27\VirtualEnvs\test\lib\site-packages\pip\_vendor\requests\sess
ions.py", line 395, in get
return self.request('GET', url, **kwargs)
File "C:\Python27\VirtualEnvs\test\lib\site-packages\pip\download.py", line 23
7, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "C:\Python27\VirtualEnvs\test\lib\site-packages\pip\_vendor\requests\sess
ions.py", line 383, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python27\VirtualEnvs\test\lib\site-packages\pip\_vendor\requests\sess
ions.py", line 486, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\VirtualEnvs\test\lib\site-packages\pip\_vendor\requests\adap
ters.py", line 381, in send
raise ProxyError(e)
ProxyError: Cannot connect to proxy. Socket error: [Errno 10054] An existing con
nection was forcibly closed by the remote host.
Storing debug log for failure in C:\Users\cjmarti2\pip\pip.log
But for some reason if I install all packages using pip install <package> they all get installed correctly.
A couple of things to consider;
1) since I am in my company's intranet I am setting a proxy using set https_proxy=https://company-proxy.com:port. 2) Installing the exact same packages using requirements.txt in a Linux machine works fine. Any ideas?
Update:
I was using Python 2.7 for 64 bits. I uninstalled it and installed the 32 bits, and I no longer had this problem. Looks like the python version was the problem, the 64 bits one for some reason cause problems.

pip install django timeout on MacOSX Lion

On a MBP, following instructions (http://techblog.rosedu.org/python-environment.html), I installed Xcode 4.4.1, brew (brew doctor says all set), and then python. Next, I tried to setup virtualenv:
> $MYPYTHON/bin/python distribute_setup.py
> $MYPYTHON/bin/easy_install pip
> $MYPYTHON/bin/pip install virtualenv
I then created a virtual environment and tried to install django:
> $MYPYTHON/bin/virtualenv $MYENV
> $MYENV/bin/pip install Django
It downloads 98% and then hangs for a while, and finally I get a traceback indicating a timeout:
pcm#pcm-mac[302]% $MYENV/bin/pip install django
Downloading/unpacking django
Downloading Django-1.4.1.tar.gz (7.7Mb): 7.5Mb downloaded
Exception:
Traceback (most recent call last):
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
status = self.run(options, args)
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 245, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 985, in prepare_files
self.unpack_url(url, location, self.is_download)
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1109, in unpack_url
retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/download.py", line 451, in unpack_http_url
download_hash = _download_url(resp, link, temp_location)
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/download.py", line 368, in _download_url
chunk = resp.read(4096)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 380, in read
data = self._sock.recv(left)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 553, in read
s = self.fp.read(amt)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 380, in read
data = self._sock.recv(left)
timeout: timed out
I see the same thing, if I just run the version of pip from /usr/local/bin/. I tried other packages (selenium, mock) and they downloaded and installed fine.
I'm at a loss as to what I may be doing wrong, or if there is some issue with django installs via pip. Advice?
Use:
pip --default-timeout=60 install django

Categories