Install Pyicu in python 3.x - python

My system is Windows 10 x64
Now I would like to install pyicu but I encounter with a problem like this
Collecting pyicu
Using cached PyICU-1.9.7.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "C:\Users\ANHVU\AppData\Local\Temp\pip-build-v5fb9ri4\pyicu\setup.py", line 12, in
ICU_VERSION = os.environ['ICU_VERSION']
File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\os.py", line 725, in getitem
raise KeyError(key) from None
KeyError: 'ICU_VERSION'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ANHVU\AppData\Local\Temp\pip-build-v5fb9ri4\pyicu\setup.py", line 26, in <module>
ICU_VERSION = check_output(('icu-config', '--version')).strip()
File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 316, in check_output
**kwargs).stdout
File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 383, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 676, in __init__
restore_signals, start_new_session)
File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 955, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ANHVU\AppData\Local\Temp\pip-build-v5fb9ri4\pyicu\setup.py", line 33, in <module>
''')
RuntimeError:
Please set the ICU_VERSION environment variable to the version of
ICU you have installed.
How can I resolve this? Help me pls.

You can download a corresponding whl file from Unofficial Windows Binaries for Python Extension Packages
For example, the latest version (as of Jan 13 2019) for your 64-bit Windows and Python3.7 version is PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl
Then open the Windows Powershell console as Administrator, cd to the directory where you put the whl file and execute the following command:
python -m pip install .\PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl
or (if you already have a previous PyICU version installed)
python -m pip install -U .\PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl

For the record:
My system (Win 10, 64 bit, python 3.8) gave me the exact same error message.
The solution was to install the 32-bit version of the PyICU whl file, not the 64 bit version.

Related

Accidentally deleted pip on my system when downgrading Python, now pip won't install

I downgraded my Python from 3.9 to 3.8, but Pip was still installing to 3.9 after the downgrade so I uninstalled Pip. I tried to reinstalling pip using: python get-pip.py from pip's documentation and pip install --upgrade --force pip, and both gives the same error:
ERROR: Exception:
Traceback (most recent call last):
File "/Users/Dan/Library/Python/3.8/lib/python/site-packages/pip/_internal/cli/base_command.py", line 180, in _main
status = self.run(options, args)
File "/Users/Dan/Library/Python/3.8/lib/python/site-packages/pip/_internal/cli/req_command.py", line 204, in wrapper
return func(self, options, args)
File "/Users/Dan/Library/Python/3.8/lib/python/site-packages/pip/_internal/commands/install.py", line 449, in run
self._handle_target_dir(
File "/Users/Dan/Library/Python/3.8/lib/python/site-packages/pip/_internal/commands/install.py", line 503, in _handle_target_dir
shutil.rmtree(target_item_dir)
File "/usr/local/Cellar/python#3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 718, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/local/Cellar/python#3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 675, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/local/Cellar/python#3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 673, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'RECORD'
When I run pip in terminal, I get:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
When I run which pip, I get:
/usr/local/bin/pip
The PermissionError you get makes me think you're not running it as sudo, especially since it's trying to use os.unlink. Try as sudo and see if it works then!

Ansible no longer works

I have been learning Ansible on Windows 10 through WSL (using Pengwin, a Debian-based Linux) and it's been working fine up until last night. This morning, it's as though it doesn't exist any more:
❯ ansible
Traceback (most recent call last):
File "/usr/bin/ansible", line 34, in <module>
from ansible import context
ModuleNotFoundError: No module named 'ansible'
Literally nothing has changed since last night. Even my computer has remained on. The only difference is that I had logged out of my terminal program.
I tried running pengwin-setup to re-install Ansible, but the issue persists.
Finally, I tried installing it via the instructions on Ansible's own site. However, things got even worse:
❯ sudo apt install software-properties-common
[sudo] password for sturm:
Reading package lists... Done
Building dependency tree
Reading state information... Done
software-properties-common is already the newest version (0.96.20.2-2.1).
0 upgraded, 0 newly installed, 0 to remove and 85 not upgraded.
❯ sudo apt-add-repository --yes --update ppa:ansible/ansible
gpg: keybox '/tmp/tmpg2r1t8x7/pubring.gpg' created
gpg: /tmp/tmpg2r1t8x7/trustdb.gpg: trustdb created
gpg: key 93C4A3FD7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported
gpg: Total number processed: 1
gpg: imported: 1
gpg: no valid OpenPGP data found.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 688, in addkey_func
func(**kwargs)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 386, in add_key
return apsk.add_ppa_signing_key()
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 273, in add_ppa_signing_key
cleanup(tmp_keyring_dir)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 234, in cleanup
shutil.rmtree(tmp_keyring_dir)
File "/usr/lib/python3.8/shutil.py", line 715, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.8/shutil.py", line 672, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.8/shutil.py", line 670, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apt/cache.py", line 570, in update
res = self._cache.update(fetch_progress, slist,
apt_pkg.Error: E:The repository 'http://ppa.launchpad.net/ansible/ansible/ubuntu groovy Release' does not have a Release file.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 168, in <module>
if not sp.add_source_from_shortcut(shortcut, options.enable_source):
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 759, in add_source_from_shortcut
cache.update(sources_list=new_debsrc_entry.file)
File "/usr/lib/python3/dist-packages/apt/cache.py", line 573, in update
raise FetchFailedException(e)
apt.cache.FetchFailedException: E:The repository 'http://ppa.launchpad.net/ansible/ansible/ubuntu groovy Release' does not have a Release file.
Now I'm out of options. How can I get Ansible running again?
Your issue is coming from the fact that you are using the instructions to install Ansible on an Ubuntu distribution, when, as you stated it, Pengwin is a Debian based one.
So you should use the chapter on how to install Ansible on Debian and not how to install Ansible on Ubuntu.
Better, still, because Pengwin is a very particular distribution, since it is a WSL one, you might want to try the installation via pip:
Ansible can be installed with pip, the Python package manager. If
pip isn’t already available on your system of Python, run the
following commands to install it:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py --user
Then install Ansible:
$ pip install --user ansible
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-with-pip

Error when installing package using pip in Python 3.6

I'm on Windows with Python 3.6.4 installed. Following the Python documentation I typed following on cmd but got error:
>py -3.6 -m pip install numpy
Traceback (most recent call last):
File "<string>", line 6, in <module>
File "__main__.py", line 126, in <module>
File "__main__py__.py", line 60, in <module>
IOError: [Errno 2] No such file or directory: '-3.6'
Python 3.6.exe is in my system PATH. What am I missing here?

Unable to install gdal in python 3.6.1 in macos Sierra

I was trying to install gdal in python 3.6.1, but getting the following error. How to overcome this?
bibinwilson ~ $ pip3 install gdal
Collecting gdal Downloading GDAL-2.2.1.tar.gz (475kB)
100% |████████████████████████████████| 481kB 397kB/s
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/GDAL.egg-info
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 131, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py",
line 707, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py",
line 1326, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 179, in get_gdal_config
return fetch_config(option, gdal_config = self.gdal_config)
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 135, in fetch_config
raise gdal_config_error(e)
__main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 131, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py",
line 707, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py",
line 1326, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 339, in <module>
**extra )
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py",
line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py",
line 955, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py",
line 974, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/egg_info.py",
line 279, in run
self.find_sources()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/egg_info.py",
line 306, in find_sources
mm.run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/egg_info.py",
line 533, in run
self.add_defaults()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/egg_info.py",
line 562, in add_defaults
sdist.add_defaults(self)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/py36compat.py",
line 36, in add_defaults
self._add_defaults_ext()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/py36compat.py",
line 119, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py",
line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py",
line 107, in ensure_finalized
self.finalize_options()
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 214, in finalize_options
self.gdaldir = self.get_gdal_config('prefix')
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 188, in get_gdal_config
return fetch_config(option)
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 135, in fetch_config
raise gdal_config_error(e)
__main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in
/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/
I had this error and installing GDAL through Homebrew fixed this for me. Installing the the binaries for GDAL didn't correct the error but once I installed through brew it was resolved.
brew install gdal
seems like the same issue as here: Python GDAL: pip install --no-install GDAL fails
If you've already installed the binaries (like I had) then this answer worked for me: https://stackoverflow.com/a/44051123/3969685
This simple procedure seemed to work for me on MAC sierra, python 3.6, GDAL 2.2.3
1) Install GDAL framework using dmg installer for MAC [GDAL MAC
Frameworks]: http://www.kyngchaos.com/software/frameworks
2) Add gdal-config folder to your path and get your version:
$ export PATH=/Library/Frameworks/GDAL.framework/Versions/2.2/Programs:$PATH
$ gdal-config --version
3) Use pip to install the version reported by gdal-config --version:
$ pip install gdal==2.2.3
Step 1 Seems to set up the python site-packages under its install framework folders and I think you could copy them to your python site-packages. But better to use pip install.
This simple procedure seemed to work for me on MAC
Install GDAL framework using Brew
> brew install gdal
gdal-config --version
gdal-config --version
2.4.4
3. GDAL Python binding
pip3 install gdal==2.4.4
Note the GDAL version of the end of the command, it must be the same as the obtained in the step above using gdal-config. To avoid conflicts or any further issues, it’s important to install and use the exact versions that any component will require.

`pip` is missing python 3.4.3, PyCharm IDE

I just installed python 3.4.3 and pyCharm 4.5, while installing module six. I got the following error message. I thought pip is included in python 3.4.3 installation. Any suggestions?
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.3\helpers\packaging_tool.py", line 56, in do_install
import pip
ImportError: No module named 'pip'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.3\helpers\packaging_tool.py", line 125, in main
retcode = do_install(pkgs)
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.3\helpers\packaging_tool.py", line 58, in do_install
error_no_pip()
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.3\helpers\packaging_tool.py", line 36, in error_no_pip
tb = sys.exc_traceback
AttributeError: 'module' object has no attribute 'exc_traceback'
UPDATE:
Okay, following suggestion below, I checked that there is no pip.exe on hard drive. So I downloaded get-pip.py and tried to install it. Here is the error message:
C:\Python34>python get-pip.py
Collecting pip
Using cached pip-7.1.0-py2.py3-none-any.whl
Collecting wheel
Using cached wheel-0.24.0-py2.py3-none-any.whl
Installing collected packages: pip, wheel
Found existing installation: pip 6.0.8
Exception:
Traceback (most recent call last):
File "C:\Users\somepath\AppData\Local\Temp\tmpram2_j5v\pip.zip\pip\basecommand
.py", line 223, in main
status = self.run(options, args)
File "C:\Users\somepath\AppData\Local\Temp\tmpram2_j5v\pip.zip\pip\commands\in
stall.py", line 299, in run
root=options.root_path,
File "C:\Users\somepath\AppData\Local\Temp\tmpram2_j5v\pip.zip\pip\req\req_set
.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "C:\Users\somepath\AppData\Local\Temp\tmpram2_j5v\pip.zip\pip\req\req_ins
tall.py", line 683, in uninstall
for path in pip.wheel.uninstallation_paths(dist):
File "C:\Users\somepath\AppData\Local\Temp\tmpram2_j5v\pip.zip\pip\wheel.py",
line 512, in unique
for item in fn(*args, **kw):
File "C:\Users\somepath\AppData\Local\Temp\tmpram2_j5v\pip.zip\pip\wheel.py",
line 531, in uninstallation_paths
r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
File "C:\Users\somepath\AppData\Local\Temp\tmpram2_j5v\pip.zip\pip\_vendor\pkg
_resources\__init__.py", line 1619, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "C:\Users\somepath\AppData\Local\Temp\tmpram2_j5v\pip.zip\pip\_vendor\pkg
_resources\__init__.py", line 1616, in get_metadata
return self._get(self._fn(self.egg_info, name)).decode("utf-8")
File "C:\Users\somepath\AppData\Local\Temp\tmpram2_j5v\pip.zip\pip\_vendor\pkg
_resources\__init__.py", line 1722, in _get
with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: 'c:\\python34\\lib\\site
-packages\\pip-6.0.8.dist-info\\RECORD'
FINAL UPDATE:
Uninstalling Python and deleting C:\Python34 folder helped. New installation came with pip. Sorry for all this mess.

Categories