Error Installing Python.net on Python 3.7 - python

I am attempting to get Python.net (pythonnet) working on Python 3.7 and when running the setup.py it fails with the following error. I'm assuming that it has to do with a missing entry in the path lines but I coulnd't fine any reference to it. It's basically a pretty plain install of Python 3.7 on Windows 7. the pip install also fails with the same results. Does anyone have a suggestion on what path or file might be missing?
PS C:\Users\user\pythonnet-master\pythonnet-master> python setup.py bdist_wheel
running bdist_wheel
running build
running build_ext
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 4.6.2.
NuGet.exe is up to date.
MSBuild auto-detection: using msbuild version '15.5.180.51428' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017
\Professional\MSBuild\15.0\bin'.
All packages listed in packages.config are already installed.
Traceback (most recent call last):
File "tools\geninterop\geninterop.py", line 292, in <module>
sys.exit(main())
File "tools\geninterop\geninterop.py", line 272, in main
python_h = preprocess_python_headers()
File "tools\geninterop\geninterop.py", line 192, in preprocess_python_headers
for line in _check_output(cmd).splitlines():
File "tools\geninterop\geninterop.py", line 41, in _check_output
output = subprocess.check_output(*args, **kwargs)
File "C:\Users\i102604\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 376, in check_output
**kwargs).stdout
File "C:\Users\i102604\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 453, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\i102604\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 756, in __init__
restore_signals, start_new_session)
File "C:\Users\i102604\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1155, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Related

Installing GDAL for python in Google Cloud Functions -- error when deploying

I've been unsuccessful in using GDAL in a Google Cloud Function with Python 3.9. I've included gdal in the "requirements.txt" file:
numpy
pygrib
requests
google-cloud-storage
gdal
But get the following error when deploying the function:
Build failed: .../setuptools/command/egg_info.py", line 541, in run
self.add_defaults()
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 578, in add_defaults
sdist.add_defaults(self)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 228, in add_defaults
self._add_defaults_ext()
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 311, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "/tmp/pip-install-d9gag00y/gdal_e01a421a21914f03a3c89fd3914501b0/setup.py", line 255, in finalize_options
gdaldir = self.get_gdal_config('prefix')
File "/tmp/pip-install-d9gag00y/gdal_e01a421a21914f03a3c89fd3914501b0/setup.py", line 194, in get_gdal_config
raise gdal_config_error(traceback_string + '\n' + msg)
__main__.gdal_config_error: Traceback (most recent call last):
File "/tmp/pip-install-d9gag00y/gdal_e01a421a21914f03a3c89fd3914501b0/setup.py", line 87, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/layers/google.python.runtime/python/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/layers/google.python.runtime/python/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
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 "/tmp/pip-install-d9gag00y/gdal_e01a421a21914f03a3c89fd3914501b0/setup.py", line 188, in get_gdal_config
return fetch_config(option, gdal_config=self.gdal_config)
File "/tmp/pip-install-d9gag00y/gdal_e01a421a21914f03a3c89fd3914501b0/setup.py", line 90, in fetch_config
raise gdal_config_error(e)
gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.; Error ID: c84b3231
Reviewing other similar posts, e.g. GDAL package missing, it seems that the GDAL library/headers needs to be installed, sudo apt-get install libgdal-dev, before the pip install gdal will work. Given that I can't run apt-get for a cloud function, does anyone have a fix or workaround?
Posting this as a community wiki to help other community members that will encounter this issue:
GDAL Libraries is not supported by Google Cloud Function at the moment. However, you can use Cloud Run for special cases where you have full control over the container.

Unable to install pyicu on MacOS

I tried installing through pip3 install pyicu and got following error:
Collecting pyicu
Using cached https://files.pythonhosted.org/packages/bb/ef/3a7fcbba81bfd213e479131ae21445a2ddd14b46d70ef0109640b580bc5d/PyICU-2.0.3.tar.gz
Complete output from command python setup.py egg_info:
Building PyICU 2.0.3 for ICU 61
Could not configure CXXFLAGS with icu-config
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/80/v1nwf70x2rz5srmzfnpc3pq40000gn/T/pip-build-b_sify1x/pyicu/setup.py", line 131, in <module>
_cflags, ('--cxxflags', '--cppflags'), 'CXXFLAGS')
File "/private/var/folders/80/v1nwf70x2rz5srmzfnpc3pq40000gn/T/pip-build-b_sify1x/pyicu/setup.py", line 30, in configure_with_icu_config
output = check_output(('icu-config',) + config_args).strip()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
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: 'icu-config'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/80/v1nwf70x2rz5srmzfnpc3pq40000gn/T/pip-build-b_sify1x/pyicu/
Then from some source I got to know that I need to install icu4c and configure by .bash_profile for icu. Also tried doing that but error persists. Please help me out.
Try running this in the command line:
export PYICU_CFLAGS=-std=c++11:-DPYICU_VER='"2.0.3"'

InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Jr1szu/Django/

I'm trying to start a Pinax Project for Django.
I setup my Python Virtual Environment.
Upgraded setup tools.
Upgraded pip.
Installed Pinax.
Then when I tried 'pinax start blog my_site', it gave the following error:
Installing Django...
Traceback (most recent call last):
File "/usr/local/bin/pinax", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 700, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 680, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 873, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 508, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 63, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 508, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pcli.py", line 97, in start
pip_install("Django")
File "/usr/local/lib/python2.7/dist-packages/pcli.py", line 23, in pip_install
command.run(opts, [package])
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 439, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 707, in call_subprocess
% (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Jr1szu/Django/
I've tried making a python virtual environment inside my conda environment. Also tried making a standalone python environment. Neither solved it. Also tried installing django using pip.
Gave the following error:
sudo pip install django
The directory '/home/scarlet/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/scarlet/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting django
Downloading Django-2.0.tar.gz (8.0MB)
100% |████████████████████████████████| 8.0MB 62kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-SNP9W5/django/setup.py", line 32, in <module>
version = __import__('django').get_version()
File "django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "django/utils/version.py", line 61, in <module>
#functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-SNP9W5/django/
What would you suggest?
Thank you for the read!
It appears like you are using python 2; if that is correct Django version 2 only supports python 3. Please refer to https://docs.djangoproject.com/en/2.0/releases/2.0/#python-compatibility
You could try installing a lower version of Django:
pip install "Django<2"
you may try:
pip3 install django

How to install PyObjC on Python 3.5 (OS X 10.10 Yosemite)?

I am trying to install PyObjC using pip3 install pyobjc-core, on a Mac with Python 3.5 and OS X 10.10.5 (Yosemite). I get the following error message:
Collecting pyobjc-core
Downloading pyobjc-core-3.1.1.tar.gz (2.2MB)
100% |████████████████████████████████| 2.2MB 481kB/s
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/pyobjc_core.egg-info
writing include/pyobjc-compat.h to pip-egg-info/pyobjc_core.egg-info/include/pyobjc-compat.h
writing include/pyobjc-api.h to pip-egg-info/pyobjc_core.egg-info/include/pyobjc-api.h
writing pip-egg-info/pyobjc_core.egg-info/PKG-INFO
writing top-level names to pip-egg-info/pyobjc_core.egg-info/top_level.txt
writing dependency_links to pip-egg-info/pyobjc_core.egg-info/dependency_links.txt
writing namespace_packages to pip-egg-info/pyobjc_core.egg-info/namespace_packages.txt
writing manifest file 'pip-egg-info/pyobjc_core.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/v0/bzvt8grs6mv33_j13_wdwqs80000gr/T/pip-build-dzm544zy/pyobjc-core/setup.py", line 696, in <module>
**parse_package_metadata()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/private/var/folders/v0/bzvt8grs6mv33_j13_wdwqs80000gr/T/pip-build-dzm544zy/pyobjc-core/setup.py", line 371, in run
egg_info.egg_info.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 180, in run
self.find_sources()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 207, in find_sources
mm.run()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 291, in run
self.add_defaults()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 320, in add_defaults
sdist.add_defaults(self)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/setuptools/command/sdist.py", line 130, in add_defaults
build_ext = self.get_finalized_command('build_ext')
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "/private/var/folders/v0/bzvt8grs6mv33_j13_wdwqs80000gr/T/pip-build-dzm544zy/pyobjc-core/setup.py", line 525, in finalize_options
universal_newlines=True).strip()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 629, in check_output
**kwargs).stdout
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 711, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/bin/xcodebuild', '-version', '-sdk', 'macosx', 'Path']' returned non-zero exit status 1
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/v0/bzvt8grs6mv33_j13_wdwqs80000gr/T/pip-build-dzm544zy/pyobjc-core/
Similar, if I try just to do pip3 install pyobjc, I get a similar trackback, ending with these fatal words:
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/v0/bzvt8grs6mv33_j13_wdwqs80000gr/T/pip-build-432fq8a3/pyobjc-core/
Any hope for me, or is there, for instance, some known incompatibility with the system bundled version of Python?
I am a month late here but the first line of the error is:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
You need to install the full version of xcode from the app store not just the command line tools. :)

Azure Batch Apps install python packages on startup

We are using Azure Batch Apps which will create multiple VMs which can be used to run our tasks parallelly. We are using python for data fetching tasks.
We have mentioned in the batch apps to install anaconda on the VMs when they start up. Anaconda is installed properly. We have listed out the packages(requirements.txt) we need to install to run the tasks.
pip install -r requirements.txt
Some packages get installed correclty, but some packages result in the following error,
Error [Error 6] The handle is invalid while executing command python setup.py egg_info
Exception:
Traceback (most recent call last):
File "C:\user\tasks\shared\anaconda2\lib\site-packages\pip\basecommand.py", line 209, in main
status = self.run(options, args)
File "C:\user\tasks\shared\anaconda2\lib\site-packages\pip\commands\install.py", line 310, in run
wb.build(autobuilding=True)
File "C:\user\tasks\shared\anaconda2\lib\site-packages\pip\wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "C:\user\tasks\shared\anaconda2\lib\site-packages\pip\req\req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\user\tasks\shared\anaconda2\lib\site-packages\pip\req\req_set.py", line 591, in _prepare_file
abstract_dist.prep_for_dist()
File "C:\user\tasks\shared\anaconda2\lib\site-packages\pip\req\req_set.py", line 127, in prep_for_dist
self.req_to_install.run_egg_info()
File "C:\user\tasks\shared\anaconda2\lib\site-packages\pip\req\req_install.py", line 430, in run_egg_info
command_desc='python setup.py egg_info')
File "C:\user\tasks\shared\anaconda2\lib\site-packages\pip\utils\__init__.py", line 678, in call_subprocess
cwd=cwd, env=env)
File "C:\user\tasks\shared\anaconda2\lib\subprocess.py", line 702, in __init__
errread, errwrite), to_close = self._get_handles(stdin, stdout, stderr)
File "C:\user\tasks\shared\anaconda2\lib\subprocess.py", line 823, in _get_handles
p2cread = _subprocess.GetStdHandle(_subprocess.STD_INPUT_HANDLE)
WindowsError: [Error 6] The handle is invalid
When we open the VM and give the same command, all packages get installed correctly.
I just wonder where the issue is.
It seems that the issue was caused by some limits for Azure Batch service, you can see these limits here.
According to the error information, it seems that the installation process needs to fork the subprocess, but the maximum number of tasks per computer node is 4, please see below.

Categories

Resources