I got many probelms to install numpy package. When i execute pip commande
pip install numpy
I get the following errors
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/numpy/Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
When i use easy_insall command, i get the following errors
Searching for numpy timed out -- Some packages may not be found!
Couldn't find index page for 'numpy' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: timed out -- Some packages may not be found!
No local packages or download links found for numpy
error: Could not find suitable distribution for Requirement.parse('numpy')
And when i employ manual packages adding
python setup.py install
I get the following errors:
Running from numpy source directory.
Cythonizing sources
numpy/random\mtrand\randint_helpers.pxi.in has not changed
Processing numpy/random\mtrand\mtrand.pyx
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'Cython'
Traceback (most recent call last):
File "C:\Hazem\Python packages\numpy\tools\cythonize.py", line 70, in process_pyx
r = subprocess.call(['cython'] + flags + ["-o", tofile, fromfile])
File "C:\Users\Hazem\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 560, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Hazem\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "C:\Users\Hazem\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 1220, 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 "C:\Hazem\Python packages\numpy\tools\cythonize.py", line 220, in <module>
main()
File "C:\Hazem\Python packages\numpy\tools\cythonize.py", line 216, in main
find_process_files(root_dir)
File "C:\Hazem\Python packages\numpy\tools\cythonize.py", line 208, in find_process_files
process(cur_dir, fromfile, tofile, function, hash_db)
File "C:\Hazem\Python packages\numpy\tools\cythonize.py", line 167, in process
processor_function(fromfile, tofile)
File "C:\Hazem\Python packages\numpy\tools\cythonize.py", line 81, in process_pyx
raise Exception('Cython failed')
Exception: Cython failed
Traceback (most recent call last):
File "setup.py", line 391, in <module>
setup_package()
File "setup.py", line 374, in setup_package
generate_cython()
File "setup.py", line 212, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!
Need help please.
You could always download the Numpy installer
The error with pip shows you have a pip connection problem. I think you did not set your proxy correctly when trying to run pip install. Please check this question. You may try --proxy option for pip. Otherwise, I don't suggest any manual install for numpy.
Maybe the reason is network ,you can try once again. (it worked for me)
Related
I would like to use the python polyglot library but I couldn't manage to use it
I installed it using the command
git clone https://github.com/aboSamoor/polyglot
cd polyglot
python setup.py install
when I want to try the code proposed on their documentation
I have the following error:
Traceback (most recent call last):
File "C:/Users/≈/PycharmProjects/s+7/main.py", line 1, in <module>
import polyglot.text
File "C:\Users\=\PycharmProjects\s+7\venv\lib\site-packages\polyglot-16.7.4-py3.7.egg\polyglot\text.py", line 11, in <module>
from polyglot.detect import Detector, Language
File "C:\Users\=\PycharmProjects\s+7\venv\lib\site-packages\polyglot-16.7.4-py3.7.egg\polyglot\detect\__init__.py", line 1, in <module >
from .base import Detector, Language
File "C:\Users\=\PycharmProjects\s+7\venv\lib\site-packages\polyglot-16.7.4-py3.
7.egg\polyglot\detect\base.py", line 11, in <module >
from icu import Locale
ModuleNotFoundError: No module named 'icu'
and I failed to install pyicu. So if someone has a solution to offer me, I'm a taker. I already try solution that on stackooverflow but it did not work.
edit: i try to install pyicu
PS C:\Users\=\PycharmProjects\s+7> python -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\=\pycharmprojects\s+7\venv\lib\site-packages (21.1.2)
Collecting pip
Using cached pip-22.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.1.2
Uninstalling pip-21.1.2:
Successfully uninstalled pip-21.1.2
Successfully installed pip-22.1
PS C:\Users\=\PycharmProjects\s+7> pip install pyicu
Collecting pyicu
Using cached PyICU-2.9.tar.gz (305 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [64 lines of output]
(running 'icu-config --version')
(running 'pkg-config --modversion icu-i18n')
Traceback (most recent call last):
File "setup.py", line 63, in <module>
ICU_VERSION = os.environ['ICU_VERSION']
File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\os.py", line 681, 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 "setup.py", line 66, in <module>
ICU_VERSION = check_output(('icu-config', '--version')).strip()
File "setup.py", line 19, in check_output
return subprocess_check_output(popenargs)
File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 411, in check_output
**kwargs).stdout
File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 488, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 69, in <module>
ICU_VERSION = check_output(('pkg-config', '--modversion', 'icu-i18n')).strip()
File "setup.py", line 19, in check_output
return subprocess_check_output(popenargs)
File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 411, in check_output
**kwargs).stdout
File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 488, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\=\pycharmprojects\s+7\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
main()
File "c:\users\=\pycharmprojects\s+7\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\=\pycharmprojects\s+7\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\=\AppData\Local\Temp\pip-build-env-sce37r8e\overlay\Lib\site-packages\setuptools\build_meta.py", line 178, in get_requires_for_build_wheel
config_settings, requirements=['wheel'])
File "C:\Users\=\AppData\Local\Temp\pip-build-env-sce37r8e\overlay\Lib\site-packages\setuptools\build_meta.py", line 159, in _get_build_requires
self.run_setup()
File "C:\Users\=\AppData\Local\Temp\pip-build-env-sce37r8e\overlay\Lib\site-packages\setuptools\build_meta.py", line 174, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 74, in <module>
''')
RuntimeError:
Please install pkg-config on your system or set the ICU_VERSION environment
variable to the version of ICU you have installed.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
and i try that : installing polyglot in windows
thanks for reading
I'm trying to install pmdarima package in a conda env as it requires statsmodels <0.12 and I would also like to use statmodels latest release for this project. My understanding is limited, but I first tried
conda skeleton pypi pmdarima
This failed with the same AttributeError related to numpy disutils described below.
Similarly to the questioner in this question: Conda skeleton pypi: ModuleNotFoundError: No module named 'numpy' I was unable to get this to work either.
conda install -n _build numpy
I then tried the advice laid out in the above-linked SO question and ran:
conda skeleton pypi --extra-specs numpy pmdarima
This results in pretty long output but the key piece as far as I can tell is:
Applying patch: '/var/folders/7f/8d7rz34522gcq4z774n9v91r0000gn/T/tmp8tv1gdnxconda_skeleton_pmdarima-1.7.1.tar.gz/pypi-distutils.patch'
patching file core.py
Hunk #1 succeeded at 168 with fuzz 2 (offset 1 line).
Partial import of pmdarima during the build process.
Requirements: ['joblib>=0.11', 'Cython>=0.29,<0.29.18', 'numpy>=1.17.3', 'pandas>=0.19', 'scikit-learn>=0.22', 'scipy>=1.3.2', 'statsmodels>=0.11,<0.12', 'urllib3', 'setuptools<50.0.0']
Setting up with numpy.distutils.core
Traceback (most recent call last):
File "setup.py", line 324, in <module>
do_setup()
File "setup.py", line 320, in do_setup
setup(**metadata)
File "/opt/anaconda3/conda-bld/skeleton_1599410605346/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/python3.7/site-packages/numpy/distutils/core.py", line 130, in setup
if dist.help or not _command_line_ok():
AttributeError: 'NoneType' object has no attribute 'help'
$PYTHONPATH = /var/folders/7f/8d7rz34522gcq4z774n9v91r0000gn/T/tmp8tv1gdnxconda_skeleton_pmdarima-1.7.1.tar.gz/pmdarima-1.7.1
Leaving build/test directories:
Work:
/opt/anaconda3/conda-bld/skeleton_1599410605346/work
Test:
/opt/anaconda3/conda-bld/skeleton_1599410605346/test_tmp
Leaving build/test environments:
Test:
source activate /opt/anaconda3/conda-bld/skeleton_1599410605346/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_place
Build:
source activate /opt/anaconda3/conda-bld/skeleton_1599410605346/_build_env
Error: command failed: /opt/anaconda3/conda-bld/skeleton_1599410605346/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/bin/python setup.py install
Any ideas? Thank you so much in advance, very much appreciated!
Not sure what the proper resolution is for the NumPy-based build, but the setup.py does check for an sdist argument, which branches to use setuptools for the build instead of numpy. Hence, the following seems to avoid the code causing the issue:
conda skeleton pypi --setup-options sdist pmdarima
I suspect the downside to this workaround is that there is no Cython compilation done, but not totally sure.
You may want to file an issue on the pmdarima GitHub to see if any of the devs have ideas. Otherwise, it might just be more efficient to pip install the package in the environment you want it (as long as that environment is not base).
#merv thank you for your help! Interestingly, this works for the skeleton, but fails when running conda-build with the following (truncated until the errors) output:
0 location(s) to search for versions of sdist:
Given no hashes to check 0 links for project 'sdist': discarding no candidates
ERROR: Could not find a version that satisfies the requirement sdist (from versions: none)
ERROR: No matching distribution found for sdist
Exception information:
Traceback (most recent call last):
File "$PREFIX/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
status = self.run(options, args)
File "$PREFIX/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
return func(self, options, args)
File "$PREFIX/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 325, in run
reqs, check_supported_wheels=not options.target_dir
File "$PREFIX/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "$PREFIX/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 388, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "$PREFIX/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 339, in _get_abstract_dist_for
self._populate_link(req)
File "$PREFIX/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 305, in _populate_link
req.link = self._find_requirement_link(req)
File "$PREFIX/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 270, in _find_requirement_link
best_candidate = self.finder.find_requirement(req, upgrade)
File "$PREFIX/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 928, in find_requirement
req)
pip._internal.exceptions.DistributionNotFound: No matching distribution found for sdist
Removed build tracker: '/private/tmp/pip-req-tracker-umxriyi2'
Traceback (most recent call last):
File "/opt/anaconda3/bin/conda-build", line 11, in <module>
sys.exit(main())
File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/cli/main_build.py", line 474, in main
execute(sys.argv[1:])
File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/cli/main_build.py", line 465, in execute
verify=args.verify, variants=args.variants)
File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/api.py", line 210, in build
notest=notest, variants=variants)
File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/build.py", line 3036, in build_tree
notest=notest,
File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/build.py", line 2155, in build
cwd=src_dir, stats=build_stats)
File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/utils.py", line 407, in check_call_env
return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/utils.py", line 387, in _func_defaulting_env_to_os_environ
raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['/bin/bash', '-o', 'errexit', '/opt/anaconda3/conda-bld/pmdarima_1599500058832/work/conda_build.sh']' returned non-zero exit status 1.
I'll confess we're well above my head at this point, (do I need to edit the meta.yaml file somehow? Is that crazy?) but will try opening an issue as you suggested, once again really appreciate it.
I am a new to Linux and have dual booted my system. I specifically want to install numpy, darknet or lightnet python packages. I tried following the instructions given here
When I run the below command:
pip install darknetpy
I am seeing the following error:
Collecting darknetpy
Using cached darknetpy-2.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-5J0HcA/darknetpy/setup.py", line 6, in <module>
import urllib.request
ImportError: No module named request
I am unable to understand what this error is about. When I tried installing numpy package, I get the below error:
Exception:
Traceback (most recent call last):
File "/home/test/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/test/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/test/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/home/test/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/test/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/home/test/.local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/test/.local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/home/test/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/numpy-1.13.3.dist-info'
Kindly help in solving this error.
OSError: [Errno 13] Permission denied Typically means you the invoker have insufficient permissions.
It looks like you are trying to pip install it using python2, as eyllanesc pointed out the package you're installing is only supported by python3, so you will have to install it first.
Here are some links to help with that:
http://ubuntuhandbook.org/index.php/2017/07/install-python-3-6-1-in-ubuntu-16-04-lts/
http://docs.python-guide.org/en/latest/starting/install3/linux/
https://tecadmin.net/install-python-3-6-on-centos/
https://gist.github.com/dschep/24aa61672a2092246eaca2824400d37f (Raspbian)
https://unix.stackexchange.com/questions/332641/how-to-install-python-3-6 (debian)
Try running the command again with sudo as in sudo pip install darknetpy, or as a super user (typically gained with sudo su) then run the command normaly.
If you are still getting ImportErrors when you are trying to pip install something, try pip installing the module that is missing.
When I run python setup.py from the source clone of Statsmodels in cmd, it is throwing the error, although the Cython installed is cython.version '0.27.3'
statsmodels-master>python setup.py install
Cythonizing sources
Processing statsmodels\nonparametric\linbin.pyx
Fatal error in launcher: Unable to create process using '"'
Traceback (most recent call last):
File "C:\Users\Test\statsmodels-master\tools\cythonize.py", line 215, in <module>
main()
File "C:\Users\Test\statsmodels-master\tools\cythonize.py", line 211, in main
find_process_files(root_dir)
File "C:\Users\Test\statsmodels-master\tools\cythonize.py", line 203, in find_process_files
process(cur_dir, fromfile, tofile, function, hash_db)
File "C:\Users\Test\statsmodels-master\tools\cythonize.py", line 174, in process
processor_function(fromfile, tofile)
File "C:\Users\Test\statsmodels-master\tools\cythonize.py", line 72, in process_pyx
raise Exception('Cython failed')
Exception: Cython failed
Traceback (most recent call last):
File "setup.py", line 546, in <module>
generate_cython()
File "setup.py", line 90, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!
Any help would be much appreciated.
Thanks in advance.
I think the error is that the setup.py file's path is not matching your python package dependency file's paths.
You can install it using this way instead of using the source code.
sudo su
your password
pip install statsmodels
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.