New install of Fenics demo crashes on MPICH_NUMVERSION - python

I am trying to run a basic demo from Fenics (2016.2.0) on Ubuntu 16.04.2, Python 2.7, Anaconda (with Spyder for the IDE). The demo is ft_01poisson.py. The error says:
RuntimeError: In instant.recompile: The module did not compile with command 'make VERBOSE=1', see '.../error/dolfin_6c..dc/compile.log'
Ok, let's take a look. Everything is fine until...
.../anaconda2/include/petscsys.h:144:6: error: #error "PETSc was configured with MPICH but now appears to be compiling using a non-MPICH mpi.h"
# error "PETSc was configured with MPICH but now appears to be compiling using a non-MPICH mpi.h"
Ok, let's see what the source says:
#elif defined(PETSC_HAVE_MPICH_NUMVERSION)
# if !defined(MPICH_NUMVERSION)
# error "PETSc was configured with MPICH but now appears to be compiling using a non-MPICH mpi.h"
I track down ~/anaconda2/include/petscconf.h:
#define PETSC_HAVE_MPICH_NUMVERSION 30200300
Now, the version of ~/anaconda2/include/mpi.h that I have in is version 2.2, but I have another version of mpi.h in a mpich-3.2.4 install which does have the correct MPICH_NUMVERSION.
I tried a simple copy and paste of the relevant files and #includes to the ~/anaconda2/include/ folder to no avail (the first error is error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]).
So how do I fix this? How do I get the demo to run after following the instructions to install Fenics?

So, the answer is to work within the FenicsProject Environment as suggested by
conda create -n fenicsproject -c conda-forge fenics
I would delete my own question, but I don't know how. Enjoy everyone!

Related

"Configuring incomplete " installing opencv contrib

Recently I want to work with SURF in opencv, but when I instelled I don't activate the option to have access to the extra modules. So, I donwloaded from https://github.com/opencv/opencv_contrib and then, I followed the steps for installation in:
add extra modules to opencv python?
But when I ran the commands for the first time I got:
CMake Error at CMakeLists.txt:11 (message): In-source builds are not allowed” in cmake
I was read some about it and the problem cames from CMakeCache.txt and has to be removed. I did it and the installation begins, but when finished my terminal shows:
-- Configuring incomplete, errors occurred!
See also "/home/chacho/opencv_build/CMakeFiles/CMakeOutput.log".
See also "/home/chacho/opencv_build/CMakeFiles/CMakeError.log"
Finally I can not run the last step. Which is the best option?...try to fixed or uninstall and install again. I don't know what I did wrong.
Notes:
I have opencv 4.1.2 version
I use Ubuntu 18.04
I work on Spyder

Issue with two versions of python

Problem having two versions of python on my Mac and them interacting. I have the following python locations
python is /anaconda3/envs/fenicsproject/bin/python
python is /usr/bin/python
and when I try to run a script. I get the following error:
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
I have googled some solutions and have found some posts saying I should try
env PYTHON_CONFIGURE_OPTS="--enable-framework" #or
env PYTHON_CONFIGURE_OPTS="--enable-shared"
This is they type of code I try to run
#Import packages
import dolfin as dl
I installed the env fenics by following the directions here
The google search possibly found Homebrew + Python on mac os x 10.8: Fatal Python error: PyThreadState_Get: no current thread importing mapnik however I was unable to find the library that links to a wrong version of python using otool.
I also found https://github.com/enthought/mayavi/issues/552 which suggests pinning to a different version of python.
Based on the install notes for hippy, https://hippylib.readthedocs.io/en/latest/installation.html then where they say conda create -n fenicproject ... you need to substitute the following:
conda create -n fenicsproject python==3.5.1
conda install -n fenicsproject -c conda-forge fenics==2017.2.0 \
mpi4py matplotlib scipy sympy==1.1.1 jupyter
After this, python -c 'import dolfin' no longer fails. It might also be possible to use a later version of python (I only tried 3.5.1).
What OS are you using? That will largely determine the specifics of how to go about correcting this issue, but the key here is which Python version the system path points to and what Python version your IDE is pointing to.
What you largely want to avoid is a situation where you are running Python scripts via your native system Python (2, likely).
Check which version of Python your IDE is using (from: How do I check what version of Python is running my script?):
import sys
print(sys.version)
Is the first number a 2? Did you want to use Python 2?
Next, let's check what version your system currently defaults to. If Ubuntu/Linux, use:
python -V
Is this expected? If not, you may need to change your system environmental variables to point to the correct Python version. The solution to this is OS dependent. If Windows, search "Edit Environmental Variables for Your Account" -> "Environmental Variables" -> "Path" , be sure it either points to Anaconda or the correct Python version; if Ubuntu/Linux, check your .bashrc file:
gedit ~/.bashrc
to see if the system points to the correct Python variable. If using a Mac, I formally apologize.

Setting python for RStudio under Anaconda

Can't change python being used when install_keras run from RStudio within Anaconda
I have several versions of Python installed on my Windows 10 box: Python 2.7, Python 3.6, plus the pythons that appear to have been installed with Anaconda. I have RStudio installed via Anaconda.
I am trying to use the keras library in my R code. I run 'install_keras()' and receive the following error:
Error: Error 1 occurred while checking for python architecture
In addition: Warning message:
running command '"C:\Python27\/python.exe" -c "import sys; import platform;
sys.stdout.write(platform.architecture()[0])"' had status 1
I have tried running install_keras using the method and conda settings:
install_keras(method="conda", conda="C:/Development/Anaconda35/Scripts")
But I still get the same error. I have also tried resetting the PATH and RETICULATE_PYTHON environmental variables, using Sys.setenv and use_python() and it doesn't seem to help.
Sys.which('PYTHON') does show the correct executable that I want to use.
Yes, my environment variables did have that Python set first in the path. But changing that didn't seem to help.
I have tried uninstalling and reinstalling keras, both the R library and the 'conda' (pip) python library. That didn't help.
I'm assuming at this point that there's some configuration or setting file with this set, but I can't seem to find it.
Suggestions?

Not able to build syntaxNet source?

I did everything given in their documentation but I'm getting this error again and again....I tried googling and finding if anyone got the same error but nopes, didn't work out. Heres the command --
bazel test --linkopt=-headerpad_max_install_names \
syntaxnet/... util/utf8/...
And heres the error -
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package 'external': Extension file '#org_tensorflow//tensorflow:tensorflow.bzl' may not be loaded from a WORKSPACE file since the extension file is located in an external repository.
INFO: Elapsed time: 0.052s
ERROR: Couldn't start the build. Unable to run test
here is a very useful script for installation on ubuntu-14.04
https://github.com/JoshData/models/blob/b72274d38f169f77e6a15e54834f463f627dc82a/syntaxnet/build/ubuntu-14.04_x64.sh
Finally solved it, it was related to the bazel version.
I had installed it before, so the version was 0.1.5. But in the docs, its written supported ones are 0.2 - 0.2.2b. I tried to upgrade it using brew but it didn't work.
So I tried to directly install it using the 0.2.2b installer and it worked :)

How do I install python on a windows machine using a cygwin terminal?

I am trying to install python through cygwin on a windows machine in order to make use of a statistical program that can only be implemented using python in a linux environment.
I have run setup-x86_64.exe and installed all python related cygwin packages in an attempt to install python, but when I open a terminal and type python I just get
$ python
-bash: python: command not found
which is the same for all python commands I try so clearly the installation has not occurred. However, I have found a path to Python-2.7.9 which appears to contain the files required to build python from source.
When I run ./configure it is successful, but when I then input make it fails due to:
File "build/temp.cygwin-1.7.35-x86_64-2.7/libffi/fficonfig.py", line 33, in <module>
ffi_sources += ffi_platforms['X86_WIN64']
KeyError: 'X86_WIN64'
Makefile:488: recipe for target 'sharedmods' failed
make: *** [sharedmods] Error 1
Anyone know why make won't work?
The options in ./configure --help are unfamiliar to me, could any of these options allow for successful installation?
Any ideas would be greatly appreciated, thank you.
Cygwin comes with an installer, called setup.exe or setup-x86_64.exe. Just run it and type python to the search box. Then let it install it for you.
python language interpreter is the basic package you need.
So, this question is 3 years old, but this error still happens with most recent versions of Python 2 (tested with 2.7.13 and 2.7.15)
I was able to get python to build by modifying the following file in the build directory.
--- build/temp.cygwin-2.11.1-x86_64-2.7/libffi/fficonfig.py~ 2018-11-03 14:51:53.290000000 -0400
+++ build/temp.cygwin-2.11.1-x86_64-2.7/libffi/fficonfig.py 2018-11-03 14:53:41.793000000 -0400
## -9,6 +9,7 ##
'X86': ['src/x86/ffi.c', 'src/x86/sysv.S', 'src/x86/win32.S'],
'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'],
'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'],
+ 'X86_WIN64': ['src/x86/ffi.c', 'src/x86/win64.S'],
'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'],
'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'],
'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'],
The source files, in particular src/x86/win64.S, are present in the source tree. For some reason, ./configure does not seem to be properly adding the option to the dictionary in the fficonfig.py file, which causes the KeyError posted in the question. After making this modification, make and make install completed successfully and I was able to install an alternate version of python in addition to the normal Cygwin package.
I'm not yet sure why this happens, but I thought I would attempt to provide a solution to the question actually asked rather than just telling the asker to install a pre-compiled version using the package manager.
Since building Python from source was said to be a bad idea, I assumed my Cygwin was broken. I attempted to uninstall Cygwin following the instructions on the Cygwin website, but I was unable to remove it due to permission difficulties (I use a university-supplied Windows machine). My last resort was to run the Cygwin installation wizard setup-x86_64.exe and uninstall all packages, then run the wizard once more and select the necessary packages again as if starting from new. Miraculously, installing the required packages from scratch solved the problem and I am now running Python through my Cygwin terminal with no errors.
If you want to run Python on Cygwin, you might need to build it from source.
download the source
unpack it to the directory you could delete later, eg: build
run Cygwin, type: cd /path/to/build
run ./configure --help and read the help about the options you'll need
./configure #options
make

Categories