pythran - File format not recognized and Unknown MS Compiler version 1800 - python

I am new to pythran and right now encountering the problem of File format not recognized as follow:
D:\DevWorkSpace\cython>pythran dprod.py
WARNING Pythran support disabled for module: omp
Looking for python27.dll
objdump.exe: D:\Program Files\Anaconda2\python27.dll: File format not recognized
CRITICAL Chair to keyboard interface error
E: Symbol table not found
Mine OS is Win 10 64bit. The version of Pythran is 0.7.4.post1. The python I use is anaconda 2:
Python 2.7.11 |Anaconda 2.3.0 (64-bit)| (default, Feb 16 2016, 09:58:36) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
Because I first tried Cython, I installed Visual Studio 2008 SP1 and Windows SKD for VC 2008 first. Then I installed MinGW for the gcc complier(gcc version 4.93) and follow this answer to use gcc compiler. This was the first time I got this problem File format not recognized.
Then I uninstall pythran and reinstall it again using:
pip install --global-option build_ext --global-option --compiler=mingw32 pythran
and I got this: failed to create process.
I also tried to install pythran from source code from pypi and installed it using:
python setup.py install. It didn't work.
In addition, I can't install pythran from conda, which gave me the following message:
C:\Users\JHW>conda install -c serge-sans-paille pythran
Fetching package metadata: ......
Solving package specifications: .
Error: Package missing in current win-64 channels:
- pythran
Did you mean one of these?
python, ipython
You can search for this package on anaconda.org with
anaconda search -t conda pythran
Finally, I also tried to replace it with another python27.dll, which is copied from \MySQL\MySQL Workbench 6.3 CE. This File format not recognized disappeared, but still pythran didn't work. By "pythran didn't work", I mean
D:\DevWorkSpace\cython>pythran dprod.py
WARNING Pythran support disabled for module: omp
CRITICAL Chair to keyboard interface error
E: Unknown MS Compiler version 1800
Thanks to #cdarke's comment, it seems that I should turn to the issue of compiler though. I have to admit that I omit this error when I posted this question. The reason I left out this question is that when I replaced the python27.dll in anaconda2, the iPython notebook in anaconda can't work (when I started it, a window of cmd pops out and disappears too soon for me to catch errors)
So my questions are:
where to find the suitable python27.dll to solve the File format not recognized problem without damaging the iPython notebook function. (or how to keep the errors at start of iPython notebook)
hints to solve the Unkown MS Compiler version 1800. (I am trying to figure out how to solve the compiler problem right now, but I am new to MS compiler. So any hints would be greatly appreciated!)
Thank you very much in advance!

According to the documentation, Pythran only supports Windows through WinPython.
The reason behind this choice is the lack of good support for all C++11 features support in Visual Studio C++ Compiler…

Related

Re-installing OpenCV (last time with dll "bundle" (exe) and now through opencv-python-contrib on Windows

I have a problem and after searching without any solutions its time for my first question on this forum.
About a month ago i downloaded openCV (opencv-4.5.5-vc14...exe) and installed it.
After about a month i now wanted to try some other trackers and therefore i need contrib.
So, i deleted the openCV directory. (this could have been stupid but i did).
When i install opencv-python-contrib (following instructions on github/opencv/opencv-python)
d:\OpenCV>pip install opencv-contrib-python
Collecting opencv-contrib-python
Using cached opencv_contrib_python-4.5.5.62-cp36-abi3-win_amd64.whl (42.2 MB)
Requirement already satisfied: numpy>=1.17.3 in c:\users\martin\appdata\roaming\python\python39\site-packages (from opencv-contrib-python) (1.22.2)
Installing collected packages: opencv-contrib-python
Successfully installed opencv-contrib-python-4.5.5.62
d:\OpenCV>python
Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print (cv2.__version__)
4.5.5
>>>
i get 4.5.5 (and no contrib add on).
I have updated pip and i have tried removing the version of python that i used in my earlier install.
I have checked path in environmental setting removing everything about opencv
What is it i´m missing?
When i uninstall (pip uninstall opencv-contrib-python) and try to import cv2 there is an error and files i have built in VS turns crazy.
When i reboot my computer and install (pip install opencv-contrib-python) we are happy campers again (besides contrib not working). as from the installation contrib is successfully installed but when i try a contrib command it does not work and the cv2.version says its not there.
Edit = When i open Visual studio/environment i have the opencv-contrib-python (4.5.5.62).
In my python/site-package i have a opencv_contrib_python-4.5.5.62.dist-info directory containning;
installer
license
license-3rd-party
metadata
record
request
top_level
wheel
Could anyone check their directory and see if they have the same so that i know that everything got installed?
I also have a cv2 map containing (amongst other files and directoris) cv2.pyd
Is there a PATH i need to fix?
Does anyone have any ideas?
Is there some information that i should provide?
I´m open to all suggestions, high and low ;)
i can use opencv in VS without any problems, its just the contrib that is missing.
sorry for my English, i´m a swede and English is far from something i brag about on my resume.
Best,
Martin
Well now its working. I could not really say how, but it does so; problem solved..

Why do I get an MKL error when running my python script on MacOS

I have a python script that was converted from an .ipynb notebook from Google Colab that I'm trying to run natively on my Mac running Big Sur.
When I try to run the script using python scriptname.py it gives me the following error:
NTEL MKL ERROR: dlopen(/Users/MyUser/opt/anaconda3/lib/libmkl_core.dylib, 9): image not found.
Intel MKL FATAL ERROR: Cannot load libmkl_core.dylib.
It occurs immediately after I try to import pandas.
I tried conda update numpy as suggested here but the problem persists.
I wondered if I didn't have pandas installed but I did pip install pandas and I got Requirement already satisfied for all 6 packages.
Any help would be appreciated.
Try following, to make sure it's not something with your conda stuff.
> python3 -m venv venv-38
> source venv-38/bin/activate
(venv-38) > pip3 install pandas
...
...
(venv-38) > python
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>> quit()
** Update **
You can easily reuse this environment in all future terminal sessions. Let's say you have this venv-38 inside $HOME. All you have to do is to open terminal session, and then
> source $HOME/venv-38/bin/activate
since now, your Python environment will be used as if it was installed inside venv-38 directory.
I finally found a solution for this. numpy also gave me the same problem so I uninstalled it pip uninstall numpy and reinstalled it pip install numpy.
I suppose I'll have to do this with all packages as I use them, but perhaps pyenv will provide a useful solution to my problem if. ever get it working.

How to use the blenderpy module from Blender in (Anaconda) Spyder

I've tried to install the module bpy (blenderpy) to be able to run python-scripts for Blender directly from Spyder IDE with Python 3.8.5. However, I can't seem to find a good solution for this.
I've tried to follow this wiki on Github to use a build provided for bpy version 2.82. I installed every required program and tried to install bpy with !pip install bpy --no-binary :all: in the Spyder-console, like it was suggested in the wiki. Unfortunately, bpy version 2.82 is not compatible with Windows Python 3.8.5:
in build_cmake
raise Exception(f"{VERSION} bpy is not compatible with "
Exception: 2.82 bpy is not compatible with Windows Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] 64bit [...]
Otherwise the installation of bpy would probably have worked.
My question is now: Is there a more recent build for bpy which can be installed with pip and is compatible with (Anaconda) Spyder python 3.8.5? If not, which Anaconda-distribution of Python do I need to install in order to be compatible with bpy 2.82? How could you manually add modules (like bpy) to your Spyder IDE that aren't available in the Anaconda-Distribution of Python and can't be installed via anaconda.org?

Python 3.6.5_1 installed in incorrect location (Mac OS)

I install python 3.6.5_1 using
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.r
and get
Warning: python 3.6.5_1 is already installed
The currently linked version is 3.7.3
You can use brew switch python 3.6.5_1 to link this version.
I use brew switch python 3.6.5_1 and get
Cleaning /usr/local/Cellar/python/3.6.5_1
Cleaning /usr/local/Cellar/python/3.7.3
4 links created for /usr/local/Cellar/python/3.6.5_1
Typing which python3, there is no output, which python gives
/usr/local/bin/python
and typing python3 gives
-bash: /usr/local/bin/python3: No such file or directory
typing python gives
Python 2.7.15 (default, Nov 27 2018, 21:24:58)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
How do I make sure that the installed python3.6.5_1 is installed at correct location and is the one referred to by python3?
Extra background :
I have been working with OpenCV for around 5 months now, following this installation guide for installing all requirements including python3.6. I was using this version of brew's python instead of mac's one. Recently I had to install FFmpeg, some errors came up, unwittingly I did something (I don't remember, probably unlinked python) and then I wasn't able to install FFmpeg anyway but also this destroyed my workspace. Right now I keep getting the following error everytime I open up terminal:
-bash: /usr/local/bin/python3: No such file or directory
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 and that PATH is
set properly.
I tried brew install python3 and that solves the above warning for virtualenvwrapper. But it installs python3.7.3, whereas I need python3.6 for tensor flow etc.

how to install Matplotlib on Cygwin?

I'm trying to install Matplotlib 1.0.1 version on latest Cygwin. In the processing, there is a weird fork error cannot be solved. I googled similar questions and found that it might be solved by manually running gcc/g++ with matplotlib 0.98.5.2 : http://innuendopoly.org/arch/matplotlib-cygwin. But it doesn't work under 1.0.1 version. Does anybody encounter the same problem?
Here are instructions for how to install matplotlib 1.1.0 on Cygwin
http://berlinbrowndev.blogspot.com/2012/01/python-matplotlib-plotting-setup-for.html
Python matplotlib plotting setup for cygwin
Matplotlib is a popular python library for generating plot graphics. It works with cygwin win32 but some non-intuitive steps are required.
Install cygwin:
CYGWIN_NT-5.1 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 Cygwin
I am using cygwin with setup 2.7.3
Install python through cygwin:
This document describes installing python and matplot with cygwin. For most windows users and cygwin users, normally you would use the external python executable. I tend to prefer all of my script oriented applications running through cygwin including python.
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
In the cygwin setup.exe installer, install:
The freetype libs, python-gtk, python-tk, libpng
gcc
Download matplotlib from sourceforge:
I am using the latest version matplotlib-1.1.0 as of 1/2012.
Download and extract the matplotlib tarball
Issues with standard python install and cygwin:
The typical 'python setup.py install' will not work with cygwin. You need to modify a configuration file and run some other additional commands.
In the root directory of the expanded matplotlib directory, copy the setup.cfg.template configuration file to setup.cfg. Edit setup.cfg.
Around line 70 in the file is a commented line, uncomment the line such that you have:
tkagg = False
Run install and watch it fail
Try running 'python setup.py install'
It should fail with an error like the following:
2 [main] python 2796 C:\cygwin\bin\python.exe: *** fatal error - unable to remap C:\cygwin\bin\cyggfortran-3.dll to same address as parent: 0x18660000 != 0x69780000
Stack trace:
Run the rebase command OUTSIDE OF THE TYPICAL CYGWIN ENV
Exit cygwin and close all cygwin instances including the one you are working with. You won't be using the typical cygwin prompt for the next command.
In windows explorer, open the cmd.exe or windows command
You will need to run rebaseall. First, shut down any long running processes like sshd, close all Cygwin prompts and so on.
Type the following commands:
cd \cygwin\bin
ash
PATH=. rebaseall -v
...
And you should get several lines of output.
Run install and watch it succeed
Try running 'python setup.py install' command again in the matplotlib directory
Running Example Program:
# python
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
import matplotlib.pyplot as pyplot
pyplot.pie([1,2,3])
pyplot.show()
pyplot.savefig('f.png')
pyplot.savefig('x.eps')
These steps taken from www.scivision.co worked for me:
Run Cygwin setup: (For some reason the original command posted in the source link did not work for me)
install packages: (most of these you may already have)
pkg-config
ghostscript
libfreetype-devel
libpng-devel
libgtk2.0-devel
gcc-g++
git
openbox
python3-numpy
python3-pyqt5
python3-devel
Then from Cygwin Terminal:
easy_install-3.6 pip
pip install --upgrade six
pip install matplotlib
Then tested from python console:
import matplotlib
matplotlib.__version__
Installation worked for me as described by Felix above.
But to use matplotlib you need to start the Xserver from Cygwin first:
startxwin
and then start your script.

Categories

Resources