Unable to install BeautifulSoup - python

abcdefg#HAL9000:~$ pip install beautifulsoup4
Downloading/unpacking beautifulsoup4
Downloading beautifulsoup4-4.1.3.tar.gz (131Kb): 131Kb downloaded
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 223, 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 955, in prepare_files
self.unpack_url(url, location, self.is_download)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1072, in unpack_url
return unpack_http_url(link, location, self.download_cache, only_download)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 447, in unpack_http_url
unpack_file(temp_location, location, content_type, link)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 468, in unpack_file
untar_file(filename, location)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 393, in untar_file
os.makedirs(location)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/abcdefg/build/beautifulsoup4'
Storing complete log in /home/abcdefg/.pip/pip.log
Since I was getting permission denied, I tried running it with sudo,
abcdefg#HAL9000:~$ sudo pip install beautifulsoup4
Downloading/unpacking beautifulsoup4
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement beautifulsoup4
No distributions at all found for beautifulsoup4
Storing complete log in /root/.pip/pip.log
I know I can install it without pip as well, but I encountered this problem while installing requests as well, so I want to know the solution
Thanks!

Related

Error about Python when installing Tensorflow

Am have tried to download both tensorflow and tensorflow-gpu on Ubuntu16.04, it didn't work..
I was using pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade tensorflow-gpu
It's ok at first, but after a while it was stuck. it appears ERROR like below:
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting tensorflow-gpu
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ce/9a/6a3985daf15d0b87b1ef3c499293cf0889cd294223a6ca28b9529770b29e/tensorflow_gpu-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl (380.8MB)
|▍ | 4.8MB 8.0kB/s eta 13:03:00ERROR: Exception:
Traceback (most recent call last):
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
status = self.run(options, args)
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 382, in run
resolver.resolve(requirement_set)
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/legacy_resolve.py", line 201, in resolve
self._resolve_one(requirement_set, req)
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/legacy_resolve.py", line 313, in _get_abstract_dist_for
req, self.session, self.finder, self.require_hashes
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 194, in prepare_linked_requirement
progress_bar=self.progress_bar
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 465, in unpack_url
progress_bar=progress_bar
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 316, in unpack_http_url
progress_bar)
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 551, in _download_http_url
_download_url(resp, link, content_file, hashes, progress_bar)
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 253, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/utils/hashes.py", line 80, in check_against_chunks
for chunk in chunks:
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 223, in written_chunks
for chunk in chunks:
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/utils/ui.py", line 160, in iter
for x in it:
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 212, in resp_read
decode_content=False):
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 564, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 529, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/home/bayar/.local/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 439, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
ReadTimeoutError: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Read timed out.
I have tried several times. I thought it were problem caused by pip, so I used pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade tensorflow-gpu also. However, another problem came up.
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade tensorflow-gpu
Collecting tensorflow-gpu
Could not find a version that satisfies the requirement tensorflow-gpu (from versions: )
No matching distribution found for tensorflow-gpu
Could you do me a favor?
To install tensorflow try this
pip3 install --upgrade tensorflow
To install tensorflow-gpu try this
pip3 install tensorflow-gpu
Check your python path using
which python
If this is equal to the python's expected path
then use the following commands to install the packages.
python -m pip install tensorflow
python -m pip install tensorflow-gpu

Install tensorflow via pip but failed just as follows

Traceback (most recent call last):<br>
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main<br>
status = self.run(options, args)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run<br>
wb.build(autobuilding=True)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build<br>
self.requirement_set.prepare_files(self.finder)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))<br>
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 821, in unpack_url
hashes=hashes<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 659, in unpack_http_url
hashes)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/utils/hashes.py", line 46, in check_against_chunks<br>
for chunk in chunks:<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 571, in written_chunks
for chunk in chunks:<br>
File "/usr/local/lib/python2.7/dist-packages/pip/utils/ui.py", line 139, in iter<br>
for x in it:<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 560, in resp_read
decode_content=False):<br>
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream<br>
data = self.read(amt=amt, decode_content=decode_content)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 324, in read<br>
flush_decoder = True<br>
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 246, in _error_catcher<br>
raise ReadTimeoutError(self._pool, None, 'Read timed out.')<br>
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
I solved it by modifying the command like this:
pip --default-timeout=100 install THEPACKAGENAME
You can also try installing using wheel packages.
The Wheel packages depend on the kind of operating system you have, the python version and whether you want to install with CPU/GPU support.
Also upgrade you protobuf before installing Tensorflow.
Please find a list of packages here:
https://www.tensorflow.org/install/install_linux#the_url_of_the_tensorflow_python_package
You can then issue this command :
$ sudo pip install --upgrade <TF wheel package URL> - For Python 2.7
$ sudo pip3 install --upgrade <TF wheel package URL> - For Python 3.x
Tensorflow site has some details on some common installation problems. You can look at those as well, just in case.
https://www.tensorflow.org/install/install_linux#common_installation_problems

Can't install packages in PyCharm (OSError: [Errno 13])

I can't install packages in PyCharm
throws this error
Collecting oktaauth
Downloading oktaauth-0.2-py2-none-any.whl
Requirement already satisfied: requests>=2.8 in /Library/Python/2.7/site-packages (from oktaauth)
Collecting argparse (from oktaauth)
Downloading argparse-1.4.0-py2.py3-none-any.whl
Collecting beautifulsoup4>=4.4 (from oktaauth)
Downloading beautifulsoup4-4.6.0-py2-none-any.whl (86kB)
Installing collected packages: argparse, beautifulsoup4, oktaauth
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 247, in move_wheel_files
prefix=prefix,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/locations.py", line 153, in distutils_scheme
i.finalize_options()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 346, in finalize_options
self.create_home_path()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 565, in create_home_path
os.makedirs(path, 0700)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Users/karanj/Library/Python/2.7'
I found soltutions by asking me to try installing it by being root or trying sudo with the command and try installing the package. But I don't want to install the package by appending sudo to it.
Any solutions?
When you start a python project, always use Python virtual environemnt. Avoid using use sudo pip install.
You can either
create Pycharm virtual environment, or
Create your typical virtualenv, then add external virtualenv to Pycharm, or
Use pycharm with conda, another virtual environment.
Try with sudo
If there is a requirement file e.g. sudo pip install -r requirements.txt
Or for standalone package
sudo pip install <package-name>

Getting errors while installing praw

I'm getting some exceptions while trying to install praw using pip. Following is the error messages I get:
MacBook:usr name_r$ pip install praw
Downloading/unpacking praw
Downloading praw-2.1.20-py2.py3-none-any.whl (74kB): 74kB downloaded
Downloading/unpacking requests>=2.3.0 (from praw)
Downloading requests-2.5.1-py2.py3-none-any.whl (464kB): 464kB downloaded
Downloading/unpacking update-checker>=0.11 (from praw)
Downloading update_checker-0.11-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six>=1.4 in /Library/Python/2.7/site-packages/six-1.8.0-py2.7.egg (from praw)
Installing collected packages: praw, requests, update-checker
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 205, in clobber
os.makedirs(destdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/praw'
Storing debug log for failure in /var/folders/qz/q26gj5zx62d3d206hdnn_rwm0000gn/T/tmp_wCuvN
Could someone tell me whats going on here? Do I need to update Python somehow or is something wrong with pip?
How can I get it to install praw properly?
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/praw'
It seems you are running on Mac, you need to change to the root user for installation, otherwise you don't have the write privilege for the folder. "sudo -s" will change to root.

python install zope.interface module, show : AssertionError: Tried to end_progress without start_progress

I use python ,and want to install module zope.interface in window 7, I used the cmd :
pip install zope.interface
but the console show :
Removing temporary dir c:\users\000790\appdata\local\temp\pip_build_000790...
Exception:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 134, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 236, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip\req.py", line 1092, in prepare_files
self.unpack_url(url, location, self.is_download)
File "C:\Python27\lib\site-packages\pip\req.py", line 1238, in unpack_url
retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
File "C:\Python27\lib\site-packages\pip\download.py", line 622, in unpack_http_url
download_hash = _download_url(resp, link, temp_location)
File "C:\Python27\lib\site-packages\pip\download.py", line 510, in _download_url
logger.end_progress('%s downloaded' % format_size(downloaded))
File "C:\Python27\lib\site-packages\pip\log.py", line 98, in end_progress
"Tried to end_progress without start_progress")
AssertionError: Tried to end_progress without start_progress
Please let me know if you have any workaround for the above error.
Donwload from here the .egg of zope.interface and try this in CMD:
c:\Python27\Scripts\easy_install.exe c:\zope.interface-3.6.1-py2.6-win32.egg
NOTE: To install .egg, we need 'Easy Install' that is part of setuptools. So, we have to install setuptools first. Download it from here.
NOTE 2: the .egg sometimes is unrecognised if it isn't on C:\ path

Categories