I happened to stumble upon an answer posted by user brentlance regarding the linking of Matlab to Python, and was wondering if I could ask the community for some advice regarding the initial setup of the mlabwrap module.
I'm on Windows 7 32 bit, using Matlab R2012a and Python 2.7 (from the Python(x,y) scientific computing package). When I try to run:
python setup.py install
in the malbwrap directory, the console returns a very large error, as presented:
WINDOWS SPECIFIC ISSUE? Unable to remove c:\users\nathan\appdata\local\temp\tmpv
tzipc; please delete it manually
[Error 32] The process cannot access the file because it is being used by anothe
r process: 'c:\\users\\nathan\\appdata\\local\\temp\\tmpvtzipc'
running install
running build
running build_py
running build_ext
building 'mlabraw' extension
Traceback (most recent call last):
File "setup.py", line 189, in <module>
extra_compile_args=EXTRA_COMPILE_ARGS,
File "C:\Python27\lib\distutils\core.py", line 152, in setup
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\distutils\command\install.py", line 563, in run
self.run_command('build')
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "C:\Python27\lib\distutils\command\build_ext.py", line 449, in build_exte
nsions
self.build_extension(ext)
File "C:\Python27\lib\distutils\command\build_ext.py", line 499, in build_exte
nsion
depends=ext.depends)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 474, in compile
self.initialize()
File "C:\Python27\lib\distutils\msvc9compiler.py", line 384, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 300, in query_vcvarsal
l
raise ValueError(str(list(result.keys())))
ValueError: [u'path']
In response to various other issues, I've thus far tried the following:
I followed the installation guide posted here
Installed Microsoft VS Express 2010 and SDK version 7.1
Set the SDK C++ compiler to the default in Matlab
Pointed the msvc9compiler.py script (C:\Python27\Lib\distutils\msvc9compiler.py) at the Common Tools folder for my VS Express install in order to avoid an 'unable to locate vcvarsall.bat' error, as described here.
Any help you guys could provide would be greatly appreciated. Many thanks.
One potential issue is that the mlabwrap module requires a C compiler to build the extension. It looks like you are using Microsoft Visual C++ Express 2010 and the SDK version 7.1, which should be sufficient. However, it is possible that the compiler is not correctly configured or is not being found by the setup.py script.
To troubleshoot this issue, you can try the following:
Make sure that the Visual C++ compiler is correctly installed and that the required environment variables are set. You can check the documentation for your version of Visual C++ for more information on how to do this.
Make sure that the setup.py script can find the compiler. You can try specifying the compiler path explicitly by setting the CC environment variable before running setup.py. For example:
set CC=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe python setup.py install
Make sure that you have the required dependencies installed. The mlabwrap module requires the NumPy and SciPy libraries to be installed. You can check that these libraries are installed and up-to-date by running the following commands:
pip install numpy --upgrade pip install scipy --upgrade