Can not import osgeo and GDAL libraries - python

I need the osgeo and GDAL libraries in python code. So, I imported them and I compiled to check whether they are installed or not (I'm not a python expert), and as expected the libraries do not exist. So, I tried to install it using the pycharm setting tools.
For the osgeo, I found two possibilities.
Django-osgeo-importer.
Django-osgeo-importer-client.
and the installation was successful. But for the GDAL I've got an error (see figure).
And I tried also to install the GDAL from the terminal and also I got this error:
anoir#anoir-Lenovo-IdeaPad-Y510P:~$ sudo -H pip install GDAL
Collecting GDAL
Using cached GDAL-2.2.1.tar.gz
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 top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-5IPiZv/GDAL/setup.py", line 339, in <module>
**extra )
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 280, in run
self.find_sources()
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 295, in find_sources
mm.run()
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 526, in run
self.add_defaults()
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 562, in add_defaults
sdist.add_defaults(self)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/py36compat.py", line 36, in add_defaults
self._add_defaults_ext()
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/py36compat.py", line 119, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/tmp/pip-build-5IPiZv/GDAL/setup.py", line 214, in finalize_options
self.gdaldir = self.get_gdal_config('prefix')
File "/tmp/pip-build-5IPiZv/GDAL/setup.py", line 188, in get_gdal_config
return fetch_config(option)
File "/tmp/pip-build-5IPiZv/GDAL/setup.py", line 141, in fetch_config
raise gdal_config_error, e""")
File "<string>", line 4, in <module>
__main__.gdal_config_error: [Errno 2] No such file or directory
----------------------------------------
Command "python setup.by egg_info" failed with error code 1 in /tmp/pip-build-5IPiZv/GDAL/
So I tried to follow this tutorial Installing GDAL/OGR on Ubuntu and it worked but when I compile the scripts the same problem persists.
Any ideas please?

Related

PROBLEMS WHEN SETTINGUP YOLOX

could somebody help me with this?
I just simple follow the instruction of megvii
python setup.py develop
the problem comeup:
(newtorch) PS D:\codeofpaper\YOLOX-main> python setup.py develop
running develop
running egg_info
writing yolox.egg-info\PKG-INFO
writing dependency_links to yolox.egg-info\dependency_links.txt
writing top-level names to yolox.egg-info\top_level.txt
reading manifest file 'yolox.egg-info\SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'yolox.egg-info\SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 63, in <module>
packages=setuptools.find_packages(),
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\site-packages\setuptools\command\develop.py", line 34, in run
self.install_for_development()
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\site-packages\setuptools\command\develop.py", line 114, in install_for_development
self.run_command('build_ext')
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\site-packages\setuptools\command\build_ext.py", line 79, in run
_build_ext.run(self)
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\distutils\command\build_ext.py", line 309, in run
force=self.force)
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\distutils\ccompiler.py", line 1032, in new_compiler
return klass(None, dry_run, force)
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\distutils\cygwinccompiler.py", line 285, in __init__
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
File "D:\Anaconda\Anaconda3\envs\newtorch\lib\distutils\cygwinccompiler.py", line 129, in __init__
if self.ld_version >= "2.10.90":
TypeError: '>=' not supported between instances of 'NoneType' and 'str'
MY CMDline output
I don't kbow what to do?
My cp is Windows10,and I use anaconda virtual env
This means that gcc was not found on your computer, i.e. cygwin is not set up correctly. distutils tries to find the version with this line:
commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version']
return tuple([_find_exe_version(cmd) for cmd in commands])
So make sure that your PATH is set up correctly so that you can run these commands from the same terminal from which you executed your pip install

AssertionError: would build wheel with unsupported tag ('cp310', 'cp310', 'linux_x86_64')

I've got this message when I try to install numpy using Python 3.10.
How to fix this?
Copying numpy.egg-info to build/bdist.linux-x86_64/wheel/numpy-1.19.3-py3.10.egg-info
running install_scripts
Traceback (most recent call last):
File "/home/walenty/.local/lib/python3.10/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/home/walenty/.local/lib/python3.10/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/walenty/.local/lib/python3.10/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 211, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 197, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 248, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 508, in <module>
setup_package()
File "setup.py", line 500, in setup_package
setup(**metadata)
File "/tmp/pip-install-p3yq92pw/numpy/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.10/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.10/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 328, in run
impl_tag, abi_tag, plat_tag = self.get_tag()
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 278, in get_tag
assert tag in supported_tags, "would build wheel with unsupported tag {}".format(tag)
AssertionError: would build wheel with unsupported tag ('cp310', 'cp310', 'linux_x86_64')
----------------------------------------
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
It's a bug in python 3.10, a workaround is installing numpy with the --no-use-pep517 flag. E.g.: pip3.10 install numpy --no-use-pep517
There's a fix for this on the way though, so just waiting is an option as well.

I've been trying to install some packages. I used python 3.6 but Now I'm trying python 3.4. Error:

C:\Python34>py -3.4 -m pip install logging
Collecting logging
Using cached logging-0.4.9.6.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info\logging.egg-info
writing top-level names to pip-egg-info\logging.egg-info\top_level.txt
writing dependency_links to pip-egg-info\logging.egg-info\dependency_links.txt
writing pip-egg-info\logging.egg-info\PKG-INFO
writing manifest file 'pip-egg-info\logging.egg-info\SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\admin\AppData\Local\Temp\pip-build-n2qiu66i\logging\setup.py", line 13, in <module>
packages = ["logging"],
File "C:\Python34\lib\distutils\core.py", line 149, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 163, in run
self.find_sources()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 186, in find_sources
mm.run()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 246, in run
self.add_defaults()
File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 282, in add_defaults
sdist.add_defaults(self)
File "C:\Python34\lib\site-packages\setuptools\command\sdist.py", line 161, in add_defaults
build_py = self.get_finalized_command('build_py')
File "C:\Python34\lib\distutils\cmd.py", line 298, in get_finalized_command
cmd_obj = self.distribution.get_command_obj(command, create)
File "C:\Python34\lib\distutils\dist.py", line 846, in get_command_obj
klass = self.get_command_class(command)
File "C:\Python34\lib\site-packages\setuptools\dist.py", line 363, in get_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "C:\Python34\lib\site-packages\pkg_resources.py", line 2029, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "C:\Python34\lib\site-packages\setuptools\command\build_py.py", line 10, in <module>
from setuptools.lib2to3_ex import Mixin2to3
File "C:\Python34\lib\site-packages\setuptools\lib2to3_ex.py", line 12, in <module>
from lib2to3.refactor import RefactoringTool, get_fixers_from_package
File "C:\Python34\lib\lib2to3\refactor.py", line 19, in <module>
import logging
File "C:\Users\admin\AppData\Local\Temp\pip-build-n2qiu66i\logging\logging\__init__.py", line 618
raise NotImplementedError, 'emit must be implemented '\
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\admin\AppData\Local\Temp\pip-build-n2qiu66i\logging\
logging is now a part of the Python Standard Library, so you don't need to install it by pip install.
And the logging module you can find on the PyPI is really out-dated, and not Python3-compatible.
(Its latest version was released at 02 Mar 2005, according to its README file)
So just stop trying to install the legacy logging. Just take the new logging module in Standard Library for granted.
Make sure that your setup.py does not specify "logging" as a dependency package.

How to set up a Virtual Environment for makerbot/s3g

I'm trying to get this module working:
https://github.com/makerbot/s3g
Their naming is a bit confusing, as the whole thing often gets referred to as "makerbot_driver" and there is also a subfolder called that.
I run into to trouble when I try to run the command:
python virtualenv.py virtualenv
When I try to run it in the makerbot_driver folder, as they suggest, I get this:
python: can't open file 'virtualenv.py': [Errno 2] No such file or directory
Which makes sense, as virtualenv.py is actually one folder up. However, when I go one folder up, and run the same command, it has a bit more success, but runs into a bunch of errors that I really can't seem to interpret:
New python executable in virtualenv/bin/python
Installing setuptools...................................
Complete output from command /home/jason/GitHub/s3g/virtualenv/bin/python -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" /home/jason/GitHub/s...ols-0.6c11-py2.7.egg:
Traceback (most recent call last):
File "<string>", line 279, in <module>
File "<string>", line 240, in main
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1712, in main
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1716, in <lambda>
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 971, in run_command
cmd_obj.ensure_finalized()
File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 125, in finalize_options
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1121, in _expand
File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/install.py", line 32, in finalize_options
File "/usr/lib/python2.7/distutils/command/install.py", line 321, in finalize_options
(prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
File "/home/jason/GitHub/s3g/virtualenv/lib/python2.7/distutils/__init__.py", line 88, in sysconfig_get_config_vars
real_vars = old_get_config_vars(*args)
File "/usr/lib/python2.7/distutils/sysconfig.py", line 495, in get_config_vars
func()
File "/usr/lib/python2.7/distutils/sysconfig.py", line 439, in _init_posix
from _sysconfigdata import build_time_vars
File "/usr/lib/python2.7/_sysconfigdata.py", line 6, in <module>
from _sysconfigdata_nd import *
ImportError: No module named _sysconfigdata_nd
----------------------------------------
...Installing setuptools...done.
Traceback (most recent call last):
File "virtualenv.py", line 2270, in <module>
main()
File "virtualenv.py", line 928, in main
never_download=options.never_download)
File "virtualenv.py", line 1040, in create_environment
search_dirs=search_dirs, never_download=never_download)
File "virtualenv.py", line 593, in install_setuptools
search_dirs=search_dirs, never_download=never_download)
File "virtualenv.py", line 567, in _install_req
cwd=cwd)
File "virtualenv.py", line 1006, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/jason/GitHub/s3g/virtualenv/bin/python -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" /home/jason/GitHub/s...ols-0.6c11-py2.7.egg failed with error code 1
I've tried to install things like the pyserial module they require and virtualenv, and that's all turned out fine, but this virtualenv thing just keeps going badly for me.
Any advice at all would be appreciated. Thanks.
That is a known bug in Ubuntu. Fix:
$ cd /usr/lib/python2.7
$ sudo ln -s plat-x86_64-linux-gnu/_sysconfigdata_nd.py .
Then it works.
$ python2.7 virtualenv.py virtualenv
New python executable in virtualenv/bin/python2.7
Not overwriting existing python script virtualenv/bin/python (you must use virtualenv/bin/python2.7)
Installing setuptools................................done.
Installing pip.....................done.

Unable to find vcvarsall.bat

I am trying to run a python project that I have not written myself. This has required me to install a series of new libraries, but more importantly, it has required me to install Cython.
I think I've installed Cython succesfully at this point. I am using MinGW for my compiler. When I try to run the project I get the error
ImportError: Building module RayTrace failed: ['DistutilsPlatformError: Unable to find vcvarsall.bat\n']
As far as I've understood this is about setting the path for the compiler. I have created the distutils.cfg file that says MinGW is the compiler as well as put MinGW in Path.
Where do I go from here?
this is the complete traceback:
Traceback (most recent call last):
File "C:\Users\Marten\Python\DisperseIt\DisperseIt.py", line 5, in <module>
from DisperseProjectDisperseCtrlFrame import *
File "C:\Users\Marten\Python\DisperseIt\DisperseProjectDisperseCtrlFrame.py", line 12, in <module>
import SectionCalc
File "C:\Users\Marten\Python\DisperseIt\SectionCalc.py", line 10, in <module>
from RayTrace import CalcIndices
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\pyximport\pyximport.py", line 431, in load_module
language_level=self.language_level)
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\pyximport\pyximport.py", line 209, in load_module
inplace=build_inplace, language_level=language_level)
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\pyximport\pyximport.py", line 186, in build_module
reload_support=pyxargs.reload_support)
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\pyximport\pyxbuild.py", line 104, in pyx_to_dll
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\Cython\Distutils\build_ext.py", line 163, in run
_build_ext.build_ext.run(self)
File "C:\Python27\lib\distutils\command\build_ext.py", line 337, in run
self.build_extensions()
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\Cython\Distutils\build_ext.py", line 171, in build_extensions
self.build_extension(ext)
File "C:\Python27\lib\distutils\command\build_ext.py", line 496, in build_extension
depends=ext.depends)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 473, in compile
self.initialize()
File "C:\Python27\lib\distutils\msvc9compiler.py", line 383, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 271, in query_vcvarsall
raise DistutilsPlatformError("Unable to find vcvarsall.bat")
ImportError: Building module RayTrace failed: ['DistutilsPlatformError: Unable to find vcvarsall.bat\n']

Categories

Resources