Installing Petsc on Windows - python

I installed cygwin with python, make and diffutils.
When I am using the command:
./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich --download-fblaslapack
I am getting an error "Windows Python Detected. Please rerun ./configure with cygwin-python".
If I use the command at the cygwin commandline
python setup.py install
I am getting the following runtime error:
Traceback (most recent call last):
File "setup.py", line 314, in <module>
**metadata)
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\__init__.py", line 143, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 230, in run
config(prefix, self.dry_run)
File "setup.py", line 166, in config
if status != 0: raise RuntimeError(status)
RuntimeError: 3
Any help welcome.

If you are building on Cygwin do NOT mix with Windows version of Python
so sanitize your PATH to have only cygwin program in it:
export PATH="/usr/local/bin:/usr/bin:/usr/lib/lapack"
./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran
about this two settings
--download-mpich --download-fblaslapack
cygwin has its own OpenMPI, Blas and Lapack packages,
so you should use them.
The package names are:
$ cygcheck -cd |grep openmpi
libopenmpi-devel 3.1.6-1
libopenmpi40 3.1.6-1
libopenmpifh40 3.1.6-1
libopenmpiusef08_40 3.1.6-1
libopenmpiusetkr40 3.1.6-1
openmpi 3.1.6-1
$ cygcheck -cd |grep "lapack\|openblas"
liblapack-devel 3.9.0-2
liblapack0 3.9.0-2
libopenblas 0.3.9-1
I am not sure but MPICH, but it will very likely NOT build under Cygwin

Related

installing pip on rhel 7.6 + failed on unknown distribution option: project_urls

we tried to installe pip on rhel machine - rhel 7.6 version ( we have python 2.7 )
as the following
ls
AUTHORS.txt build dist docs LICENSE.txt MANIFEST.in NEWS.rst PKG-INFO pyproject.toml README.rst setup.cfg setup.py src
python setup.py install
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'
warnings.warn(msg)
Traceback (most recent call last):
File "setup.py", line 87, in <module>
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 269, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib64/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 302, in finalize_options
ep.load()(self, ep.name, value)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2443, in load
return self.resolve()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2453, in resolve
raise ImportError(str(exc))
ImportError: 'module' object has no attribute 'check_specifier'
we can see that installing is complain about
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
so we looked on setup.py
and we marked the following line - python_requires
entry_points={
"console_scripts": [
"pip=pip._internal.cli.main:main",
"pip{}=pip._internal.cli.main:main".format(sys.version_info[0]),
"pip{}.{}=pip._internal.cli.main:main".format(
*sys.version_info[:2]
),
],
},
zip_safe=False,
#python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*', )
then we run again
installation is now better and we can see the pip is installed as
which pip
/usr/bin/pip
but last lines are:
Traceback (most recent call last):
File "setup.py", line 86, in <module>
zip_safe=False,
File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 73, in run
self.do_egg_install()
File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 101, in do_egg_install
cmd.run()
File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 380, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 604, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 655, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 701, in process_distribution
distreq.project_name, distreq.specs, requirement.extras
TypeError: __init__() takes exactly 2 arguments (4 given)
so after re-run again the python setup.py install , installation succeeded without errors
example of last lines:
Extracting pip-20.1.1-py2.7.egg to /usr/lib/python2.7/site-packages
pip 20.1.1 is already the active version in easy-install.pth
Installing pip script to /usr/bin
Installing pip2.7 script to /usr/bin
Installing pip2 script to /usr/bin
Installed /usr/lib/python2.7/site-packages/pip-20.1.1-py2.7.egg
Processing dependencies for pip==20.1.1
Finished processing dependencies for pip==20.1.1
so the workaround here was the following
marked the line as
# python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
and run the following twice
python setup.py install
but this workaround maybe works but it is ugly
any suggestion how to fix the pip installation ?
reference - Using python_requires to require Python 2.7 or 3.2+

AttributeError: 'MSVCCompiler' object has no attribute 'compiler_so'

I'm trying to run some faster r cnn tf code that I got from GitHub. All those code need to run 'make' command to run the Cython (correct me if I am wrong). But everytime I run the make command I always got the same problem for every code.
I'm using windows 10 professional with python 3.5
My tensorflow version is 1.8.0 with gpu and CUDA 9.0
here is the error from the command line :
python setup.py build_ext --inplace
running build_ext
Traceback (most recent call last):
File "setup.py", line 150, in <module>
cmdclass={'build_ext': custom_build_ext},
File "C:\Users\USER\AppData\Local\Programs\Python\Python35\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\USER\AppData\Local\Programs\Python\Python35\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\USER\AppData\Local\Programs\Python\Python35\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\USER\AppData\Local\Programs\Python\Python35\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "C:\Users\USER\AppData\Local\Programs\Python\Python35\lib\distutils\command\build_ext.py", line 338, in run
self.build_extensions()
File "setup.py", line 104, in build_extensions
customize_compiler_for_nvcc(self.compiler)
File "setup.py", line 77, in customize_compiler_for_nvcc
default_compiler_so = self.compiler_so
AttributeError: 'MSVCCompiler' object has no attribute 'compiler_so'
make: *** [all] Error 1
The .compiler_so field is only present in distutils.unixcompiler.UnixCCompiler and derivatives.
So, this package does not support standard Windows build environment.
As per Build from source on Windows | TensorFlow, it's supposed to be built using MSYS2.

How can I install GDAL in Ubuntu 16,04 with python 2.7.12 using pip?

I am trying to import some specific libraries using python. it should be easy like importing numpy for example like so:
import osgeo.gdal, gdal
from osgeo.gdalconst import *
But it seemed to me like the packages gdal and osgeo are missing so I went to the project interpreter to add these packages, Sadly i did not find the package osgeo and the package gdal could not be installed ... I looked it up in the net but it seems that there is no exact way to solve the matter.
I am using Ubuntu 16,04 with python 2.7.12 and PS GDAL is Geospatial Data Abstraction Library
This the error message that I am getting:
Collecting gdal
Using cached GDAL-2.2.3.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'
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pycharm-packaging347/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 "build/bdist.linux-x86_64/egg/setuptools/command/egg_info.py", line 180, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/egg_info.py", line 207, in find_sources
File "build/bdist.linux-x86_64/egg/setuptools/command/egg_info.py", line 291, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/egg_info.py", line 320, in add_defaults
File "build/bdist.linux-x86_64/egg/setuptools/command/sdist.py", line 130, in add_defaults
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/pycharm-packaging347/gdal/setup.py", line 214, in finalize_options
self.gdaldir = self.get_gdal_config('prefix')
File "/tmp/pycharm-packaging347/gdal/setup.py", line 188, in get_gdal_config
return fetch_config(option)
File "/tmp/pycharm-packaging347/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.py egg_info" failed with error code 1 in /tmp/pycharm-packaging347/gdal/
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Finally I found a solution to my problem.
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin
sudo apt-get -y install python-gdal
Thank you all for the contribution.

Unable to install Flask-Mail

I am trying to send an email using Flask when a user registers on my website. I used the command pip install Flask-Mail to install. However, I get the following error of possible version mismatch:
Downloading/unpacking Flask-mail
Downloading Flask-Mail-0.9.1.tar.gz (45kB): 45kB downloaded
Running setup.py (path:/tmp/pip_build_root/Flask-mail/setup.py) egg_info for package Flask-mail
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/Flask-mail/setup.py", line 52, in <module>
'Topic :: Software Development :: Libraries :: Python Modules'
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 225, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 257, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2029, in require
working_set.resolve(self.dist.requires(self.extras),env,installer))
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 592, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (certifi 2016.2.28 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('certifi==2015.11.20'))
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/Flask-mail/setup.py", line 52, in <module>
'Topic :: Software Development :: Libraries :: Python Modules'
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 225, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 257, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2029, in require
working_set.resolve(self.dist.requires(self.extras),env,installer))
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 592, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (certifi 2016.2.28 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('certifi==2015.11.20'))
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/Flask-mail
Any possible workarounds? Any help will be greatly appreciated. Thanks!
The easiest way to avoid these kind of problems is to create a virtual environment
>>>pip install virtualenv
>>>cd my_project_folder
>>>virtualenv venv
now activate your virtual environment
>>>source venv/bin/activate
now install there pip install Flask-Mail
hopefully now it should work there
if your done working then deactivate it
>>>deactivate
or
It seems like all the problem is because of certifi version conflict
so try downloading the source from here
https://pypi.python.org/pypi/certifi
and install from source
Extract it go into the folder and run this command
sudo python setup.py install
and it should work
peace
If you do not have virtual env set up I would suggest do so first. If you have that already you may need to activate that from your terminal:
>>>source venv/bin/activate
Once completed just deactivate it for your rest of the commands:
>>>deactivate

Installing Fabric On Windows (Error No Module Called Readline)

I'm trying to use the Fabric 0.1.1 deploy tool (http://docs.fabfile.org/) on Windows and we're running into an issue with the readline module. I've been through various threads but can't seem to solve the issue. It's important because we can't deploy applications from Windows based machines.
C:\Documents and Settings\dev\Desktop\deploy>fab
Traceback (most recent call last):
File "C:\python\Scripts\fab-script.py", line 8, in <module>
load_entry_point('fabric==0.1.1', 'console_scripts', 'fab')()
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 277, in load_entry_point
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 2180, in load_entry_point
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 1913, in load
File "build\bdist.win32\egg\fabric.py", line 25, in <module>
**ImportError: No module named readline**
Installing the module results in:
**easy_install readline**
Searching for readline
Reading http://pypi.python.org/simple/readline/
Reading http://www.python.org/
Best match: readline 2.6.4
Downloading http://pypi.python.org/packages/source/r/readline/readline-2.6.4.tar
.gz#md5=7568e8b78f383443ba57c9afec6f4285
Processing readline-2.6.4.tar.gz
Running readline-2.6.4\setup.py -q bdist_egg --dist-dir c:\docume~1\ji81b9~1.che
\locals~1\temp\easy_install-pzkz1a\readline-2.6.4\egg-dist-tmp-szs2ps
Traceback (most recent call last):
File "C:\python\Scripts\easy_install-script.py", line 8, in <module>
load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')()
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1671, in main
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1659, in with_ei_usage
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1675, in <lambda>
File "c:\python\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "c:\python\lib\distutils\dist.py", line 975, in run_commands
self.run_command(cmd)
File "c:\python\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 211, in run
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 446, in easy_install
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 476, in install_item
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 655, in install_eggs
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 930, in build_and_install
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 919, in run_setup
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 27, in run_setup
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 63, in run
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 29, in <lambda>
File "setup.py", line 93, in <module>
AttributeError: 'module' object has no attribute 'symlink'
Has anybody solved this issue or can anybody suggest a workaround?
The readline module you are trying to install with easy_install is for OS X, not windows. There are Windows-compatible replacements for readline out there but perhaps you should first try updating fabric itself to a more current version (0.9 is out there now).
Grepping the source of the 0.9 version does not find any dependencies on readline.
Following these steps exactly worked for me:
1) Installed using the MSI installer for x86 from here.
2) Installed in the default C:\Python27 directory.
3) Create a new directory: C:\Python27\Scripts
4) Added C:\Python27 and C:\Python27\Scripts to the system path:
5) Download the distribute_setup.py from here into C:\Python27\Scripts
6) Open a command line, navigate to C:\Python27\Scripts, run: 'python distribute_setup.py'
7) now run 'easy_install pip'
8) now run 'pip install fabric'
9) You should get an error saying PyCrypto couldn't install. You can download the pre-build Windows binary from here. Run this to install PyCrypto.
10) run 'pip install fabric' again and it should say everything is installed.
11) in a different directory (let's say c:\dev\hello) create a fabfile.py and add the following code:
def hello(name="world"):
print("Hello %s!" % name)
12) cd to this directory and run 'fab hello:working'. You should see output say
Hello working!
Done.
Give this readline a try. It is a module for Windows that allows additional features in IPython that aren't native and might work with what you are trying to do.
0.1.1 is an older version, I believe. I have no problem installing Fabric on Windows with ActivePython (w/ PyPM):
C:\> pypm install fabric
Ready to perform these actions:
The following packages will be installed:
fabric-0.9.0 pycrypto-2.0.1
Get: [pypm.activestate.com] fabric 0.9.0-1
Get: [pypm.activestate.com] pycrypto 2.0.1-1
Installing fabric-0.9.0
Fixing script C:\Users\sridharr\AppData\Roaming\Python\Scripts\fab-script.py
Installing pycrypto-2.0.1
Download and run easy_install installer for your python version from http://pypi.python.org/pypi/setuptools#downloads . ie: setuptools-0.6c11.win32-py2.6.exe
On the command prompt, lauch easy_install -U fabric to install the last fabric release.
Readline should be available with Cygwin, if you want to move your entire stack in that direction.

Categories

Resources