Installation error:Pyproj - python

I try to install pyprog from cmd but I've the following error. Who can explain me to fix it?!
Collecting pyproj (from LatLon)
Using cached pyproj-1.9.5.1.tar.gz
Complete output from command python setup.py egg_info:
using bundled proj4..
Traceback (most recent call last):
File "C:\Users\Andrea\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\msvc.py", line 490, in _find_latest_available_vc_ver
return self.find_available_vc_vers()[-1]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Andrea\AppData\Local\Temp\pycharm-packaging\pyproj\setup.py", line 72, in <module>
objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
File "C:\Users\Andrea\AppData\Local\Programs\Python\Python36\lib\distutils\_msvccompiler.py", line 345, in compile
self.initialize()
File "C:\Users\Andrea\AppData\Local\Programs\Python\Python36\lib\distutils\_msvccompiler.py", line 238, in initialize
vc_env = _get_vc_env(plat_spec)
File "C:\Users\Andrea\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "C:\Users\Andrea\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\msvc.py", line 844, in __init__
self.si = SystemInfo(self.ri, vc_ver)
File "C:\Users\Andrea\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\msvc.py", line 486, in __init__
self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
File "C:\Users\Andrea\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\msvc.py", line 493, in _find_latest_available_vc_ver
raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Andrea\AppData\Local\Temp\pycharm-packaging\pyproj\

For those on Macs that won't find helpful answers: try
pip install git+https://github.com/jswhit/pyproj.git
this will probably ask you to install cython, so do just this
pip install cython
This worked for me when nothing else worked. Thanks to #micahcochran on github.

The solution is written in the last line:
Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
Did you tried download and install it?

You can download pyproj binaries from here and install via: pip install <filename>.whl

Related

Trying to install scikit-learn shows comman exit out with error status 1

I am trying to install the sklearn package and it does not work. I have numpy installed as well as scipy and have tried updating installing tools. I'm using Pycharm on Python 3.10. This is the error message that shows up
PS C:\Users\jason\PycharmProjects\pythonProject> pip install scikit-learn
Collecting scikit-learn
Using cached scikit-learn-1.0.1.tar.gz (6.6 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\jason\pycharmprojects\pythonproject\venv\scripts\python.exe' 'c:\users\jason\pycharmprojects\pythonproject\venv\lib\site-packages\pip\_vendor\pe
p517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\jason\AppData\Local\Temp\tmplhn1abe4'
cwd: C:\Users\jason\AppData\Local\Temp\pip-install-i9q_z62l\scikit-learn_6c9f7571f4fc41f3a90540d946328d80
Complete output (46 lines):
Partial import of sklearn during the build process.
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
Traceback (most recent call last):
File "c:\users\jason\pycharmprojects\pythonproject\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
main()
File "c:\users\jason\pycharmprojects\pythonproject\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "c:\users\jason\pycharmprojects\pythonproject\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 164, in prepare_metadata_for_build_w
heel
return hook(metadata_directory, config_settings)
File "C:\Users\jason\AppData\Local\Temp\pip-build-env-e2qd4m88\overlay\Lib\site-packages\setuptools\build_meta.py", line 174, in prepare_metadata_for_build_wheel
self.run_setup()
File "C:\Users\jason\AppData\Local\Temp\pip-build-env-e2qd4m88\overlay\Lib\site-packages\setuptools\build_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "C:\Users\jason\AppData\Local\Temp\pip-build-env-e2qd4m88\overlay\Lib\site-packages\setuptools\build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 319, in <module>
setup_package()
File "setup.py", line 315, in setup_package
setup(**metadata)
File "C:\Users\jason\AppData\Local\Temp\pip-build-env-e2qd4m88\overlay\Lib\site-packages\numpy\distutils\core.py", line 135, in setup
config = configuration()
File "setup.py", line 201, in configuration
config.add_subpackage("sklearn")
File "C:\Users\jason\AppData\Local\Temp\pip-build-env-e2qd4m88\overlay\Lib\site-packages\numpy\distutils\misc_util.py", line 1016, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "C:\Users\jason\AppData\Local\Temp\pip-build-env-e2qd4m88\overlay\Lib\site-packages\numpy\distutils\misc_util.py", line 982, in get_subpackage
config = self._get_configuration_from_setup_py(
File "C:\Users\jason\AppData\Local\Temp\pip-build-env-e2qd4m88\overlay\Lib\site-packages\numpy\distutils\misc_util.py", line 924, in _get_configuration_from_setup
_py
config = setup_module.configuration(*args)
File "sklearn\setup.py", line 85, in configuration
cythonize_extensions(top_path, config)
File "C:\Users\jason\AppData\Local\Temp\pip-install-i9q_z62l\scikit-learn_6c9f7571f4fc41f3a90540d946328d80\sklearn\_build_utils\__init__.py", line 47, in cythoniz
e_extensions
basic_check_build()
File "C:\Users\jason\AppData\Local\Temp\pip-install-i9q_z62l\scikit-learn_6c9f7571f4fc41f3a90540d946328d80\sklearn\_build_utils\pre_build_helpers.py", line 113, i
n basic_check_build
compile_test_program(code)
File "C:\Users\jason\AppData\Local\Temp\pip-install-i9q_z62l\scikit-learn_6c9f7571f4fc41f3a90540d946328d80\sklearn\_build_utils\pre_build_helpers.py", line 70, in
compile_test_program
ccompiler.compile(
File "C:\Users\jason\AppData\Local\Programs\Python\Python310\lib\distutils\_msvccompiler.py", line 323, in compile
self.initialize()
File "C:\Users\jason\AppData\Local\Programs\Python\Python310\lib\distutils\_msvccompiler.py", line 220, in initialize
vc_env = _get_vc_env(plat_spec)
File "C:\Users\jason\AppData\Local\Temp\pip-build-env-e2qd4m88\overlay\Lib\site-packages\setuptools\msvc.py", line 316, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File "C:\Users\jason\AppData\Local\Temp\pip-build-env-e2qd4m88\overlay\Lib\site-packages\setuptools\msvc.py", line 270, in _msvc14_get_vc_env
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.c
om/visual-cpp-build-tools/
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/62/7c/596ff7b32f655f379d3abdfa82607e5cb3b70f46baad4604706511cfeb85/scikit-learn-1.0.1.tar.gz#sha256=ac2ca9
dbb754d61cfe1c83ba8483498ef951d29b93ec09d6f002847f210a99da (from https://pypi.org/simple/scikit-learn/) (requires-python:>=3.7). Command errored out with exit status
1: 'c:\users\jason\pycharmprojects\pythonproject\venv\scripts\python.exe' 'c:\users\jason\pycharmprojects\pythonproject\venv\lib\site-packages\pip\_vendor\pep517\in_p
rocess\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\jason\AppData\Local\Temp\tmplhn1abe4' Check the logs for full command output.
I faced the same problem with having python 3.10.1 installed in my system (fedora35). This error occured both in my os and virtual environment. Later I installed python3.7 and from venv I could install scikit-learn.Try installing scikit-learn from different python version, which should work.
Same problem here.
noted that scilean only supported by python 2.7, 2.8 and 2.9.
so just downgrade python to 2.8 then reinstall scilearn.

Python: Choosing C++ compiler on Windows -- MS Visual Studio to Mingw-w64. (PyStan CompileError)

I'm getting a CompileError when running a simple PyStan model in Python:
WARNING:pystan:MSVC compiler is not supported
Traceback (most recent call last): File
"C:\Python36\lib\distutils_msvccompiler.py", line 423, in compile
self.spawn(args) File "C:\Python36\lib\distutils_msvccompiler.py", line 542, in spawn
return super().spawn(cmd) File "C:\Python36\lib\distutils\ccompiler.py", line 909, in spawn
spawn(cmd, dry_run=self.dry_run) File "C:\Python36\lib\distutils\spawn.py", line 38, in spawn
_spawn_nt(cmd, search_path, dry_run=dry_run) File "C:\Python36\lib\distutils\spawn.py", line 81, in _spawn_nt
"command %r failed with exit status %d" % (cmd, rc)) distutils.errors.DistutilsExecError: command 'C:\Program Files
(x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe'
failed with exit status 1 During handling of the above exception,
another exception occurred: Traceback (most recent call last): File
"C:\panormus\venv2\lib\site-packages\IPython\core\interactiveshell.py",
line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in
sm = pystan.StanModel(model_code=model) File "C:\panormus\venv2\lib\site-packages\pystan\model.py", line 349, in
init
build_extension.run() File "C:\Python36\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions() File "C:\Python36\lib\distutils\command\build_ext.py", line 448, in
build_extensions
self._build_extensions_serial() File "C:\Python36\lib\distutils\command\build_ext.py", line 473, in
_build_extensions_serial
self.build_extension(ext) File "C:\Python36\lib\distutils\command\build_ext.py", line 533, in
build_extension
depends=ext.depends) File "C:\Python36\lib\distutils_msvccompiler.py", line 425, in compile
raise CompileError(msg) distutils.errors.CompileError: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 1
I've isntalled Pystan using pip (pip install PyStan) on Python 3.6 and am trying to run a simple model (first example here)
I have both MS Visual Studio (not supported) and MinGW-64 (supported) installed on my PC. MinGW works fine to compile similar models using PyMC3, so it seems to me I just need to get my Pystan package to recognize the installation and use that compiler instead. Unfortunately even if that is correct, I am not sure how to do that, can someone help?
Answering myself here. It turns out that others have had similar issues and that the 'standard solution' seems to be to run a conda virtual environment for all pystan modelling. The pystan docs have detailed installation instructions for conda, which worked for me, but no support for non-conda users.

Can't install tables on Python

I keep getting the error
Command "python setup.py egg_info" failed with error code 1 in C:\Users\HP\AppData\Local\Temp\pip-install-sv33cp8y\tables\
when trying to use
pip install tables
I've tried
pip install --upgrade setuptools
and quite a few other things but still can't get it to work.
The full error that I'm getting is:
Collecting tables
Using cached https://files.pythonhosted.org/packages/4d/53/8f34ce887c2a2ad80518980419a5f6f41defc85a287a355987e559ce9385/tables-3.4.4.tar.gz
Complete output from command python setup.py egg_info:
* Using Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)]
* USE_PKGCONFIG: False
Traceback (most recent call last):
File "c:\python37\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver
return self.find_available_vc_vers()[-1]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\HP\AppData\Local\Temp\pip-install-5bjrxgs8\tables\setup.py", line 633, in <module>
libraries=(package.library_name,))
File "c:\python37\lib\distutils\ccompiler.py", line 791, in has_function
objects = self.compile([fname], include_dirs=include_dirs)
File "c:\python37\lib\distutils\_msvccompiler.py", line 345, in compile
self.initialize()
File "c:\python37\lib\distutils\_msvccompiler.py", line 238, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\python37\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "c:\python37\lib\site-packages\setuptools\msvc.py", line 843, in __init__
self.si = SystemInfo(self.ri, vc_ver)
File "c:\python37\lib\site-packages\setuptools\msvc.py", line 485, in __init__
self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
File "c:\python37\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\HP\AppData\Local\Temp\pip-install-5bjrxgs8\tables\
I'm basically trying to convert a hdf5 file into a csv and I just can't get it to work or anything at the moment.
Might be a permission issue.
Try :
sudo pip install --upgrade setuptools
Also refer to the discussion here. Some folks had this problem with python version.

"python setup.py egg_info" error for pyproj package but not others

I've been trying to install the pyproj python package (I want to use the stateplane part specifically). Long story short.. I have a csv of lat, long, and a variable value and wanted to extract data for each state. I was going to use the
stateplane.identify(-80.1, 36.2, fmt='short')
feature to identify the state. I have verified that I have python 3.6.3 and pip 9.0.1. Doing pip install worked for the libusb package, but I'm getting an error when I do
pip install pyproj
Collecting pyproj
Using cached pyproj-1.9.5.1.tar.gz
Complete output from command python setup.py egg_info:
using bundled proj4..
Traceback (most recent call last):
File "c:\python36-32\lib\site-packages\setuptools\msvc.py", line 490, in _
find_latest_available_vc_ver
return self.find_available_vc_vers()[-1]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\smshp\AppData\Local\Temp\pip-build-_bzisu0o\pyproj\setup.py
", line 72, in <module>
objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
File "c:\python36-32\lib\distutils\_msvccompiler.py", line 345, in compile
self.initialize()
File "c:\python36-32\lib\distutils\_msvccompiler.py", line 238, in initial
ize
vc_env = _get_vc_env(plat_spec)
File "c:\python36-32\lib\site-packages\setuptools\msvc.py", line 185, in m
svc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "c:\python36-32\lib\site-packages\setuptools\msvc.py", line 844, in _
_init__
self.si = SystemInfo(self.ri, vc_ver)
File "c:\python36-32\lib\site-packages\setuptools\msvc.py", line 486, in _
_init__
self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
File "c:\python36-32\lib\site-packages\setuptools\msvc.py", line 493, in _
find_latest_available_vc_ver
raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is requir
ed. Get it with "Microsoft Visual C++ Build Tools":
http://landinghub.visualstud
io.com/visual-cpp-build-tools
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\smshp\Ap
pData\Local\Temp\pip-build-_bzisu0o\pyproj\
I have followed the troubleshooting tips from this post word to no avail.
Alternatively, if I downloaded the repo and did
python setup.py install
would I download the .whl or tar.gz file and would I download it to the python36-32 directory or where?
Thanks!

pystan: distutils.errors.CompileError: command 'gcc' failed with exit status 1

I'm using Ubuntu 14.04.3 and latest version of anaconda.
When pystan tries to compile models, I get the following error:
distutils.errors.CompileError: command 'gcc' failed with exit status 1
When I try running the models on my RHEL server at work, everything works fine.
Before installing pystan, I ran
apt-get install build-essential
I've tried installing stan using anaconda and building from source, and I still get the error.
I have no idea what to try next.
Edit: Full error output is below
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_900950b5a4d15a106db93874d106a01d NOW.
Traceback (most recent call last):
File "schools.py", line 63, in <module>
main()
File "schools.py", line 59, in main
output = fit()
File "schools.py", line 54, in fit
res = pystan.stan(model_code=pasted_code(), data=model_data, iter=1000, chains=4)
File "/home/hahdawg/anaconda/lib/python2.7/site-packages/pystan/api.py", line 373, in stan
save_dso=save_dso, verbose=verbose)
File "/home/hahdawg/anaconda/lib/python2.7/site-packages/pystan/model.py", line 319, in __init__
build_extension.run()
File "/home/hahdawg/anaconda/lib/python2.7/distutils/command/build_ext.py", line 337, in run
self.build_extensions()
File "/home/hahdawg/anaconda/lib/python2.7/distutils/command/build_ext.py", line 446, in build_extensions
self.build_extension(ext)
File "/home/hahdawg/anaconda/lib/python2.7/distutils/command/build_ext.py", line 496, in build_extension
depends=ext.depends)
File "/home/hahdawg/anaconda/lib/python2.7/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/home/hahdawg/anaconda/lib/python2.7/distutils/unixccompiler.py", line 122, in _compile
raise CompileError, msg
distutils.errors.CompileError: command 'gcc' failed with exit status 1
In case anyone has the same issue, the following steps fixed the problem
Uninstall Anaconda
Install Anaconda
Install pystan using pip
No idea why that worked.

Categories

Resources