mmApi on Windows 10

mmApi on Windows 10

Anonymous
Not applicable
5,380 Views
17 Replies
Message 1 of 18

mmApi on Windows 10

Anonymous
Not applicable

I got some installation problems with mmAPI on my PC, installed it yesterday on macOs without problems.

What did i do so far:

a) downloaded mmAPI from gitHub

b) extraction the zip File

c) running build_python_distrib.bat, which ended very fast, is there any logFile? On MacOS the makefile was running for 30s with a lot of output.

d) installing Visual Studio 2019

e)  installing python 2.7.17 Shell and IDLE

 

when opening the test.py in pythonShell and running it the following Error appears:

Python 2.7.17 (v2.7.17:c2f86d86e6, Oct 19 2019, 21:01:17) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
============== RESTART: C:\mm-api-master\distrib\python\test.py ==============

Traceback (most recent call last):
File "C:\mm-api-master\distrib\python\test.py", line 1, in <module>
import mmapi
File "C:\mm-api-master\distrib\python\mmapi.py", line 26, in <module>
_mmapi = swig_import_helper()
File "C:\mm-api-master\distrib\python\mmapi.py", line 18, in swig_import_helper
import _mmapi
ImportError: No module named _mmapi
>>>

 

is there something like $Path under macOS? What is the best way to start an pythonScript? With macOS i go to terminal and type python (which is found under /usr/bin ) ./test.py

 

0 Likes
Accepted solutions (1)
5,381 Views
17 Replies
Replies (17)
Message 2 of 18

Anonymous
Not applicable

Can't help that much on WIN10...

Is there a _mmapi.pyd file in mm-api-master/distrib/python ?

Instead of building from scratch: Did you try to use the distrib which comes with the download?

 

Maybe @hfcandrew is able to help?

 

0 Likes
Message 3 of 18

hfcandrew
Advisor
Advisor

Ya I had to redo a couple things when I got mine working. Some errors ended up coming from the github version and also from how i installed python and etc etc.

 

So:

 

1) Install Python 2.7.16 from: https://www.python.org/downloads/release/python-2716/

- use the 32-bit version (Windows x86 MSI installer) Windows x86 MSI installer

- install it wherever, I used C:\Python27\.

- just before you approve the install, go to the bottom and have the

   python installer add the python install directories to the Windows

   PATH variable (is it not enabled by default).

- when done, open a PowerShell window and type "python.exe", just to

   check. (not x86 powershell)

 

2) Don't use the github files, they need a lot of work to run on Win10

 

3) I run my various scripts via IDLE, so make sure you have them plus all the above saved in the same directory as the main mmapi ie. "\Documents\meshmixerpython"

 

4) Open MM, load a bunny, Run 'test.py' and make sure it is cutting your bunny in half

Message 4 of 18

Anonymous
Not applicable
Accepted solution

Works like a charm!

Thank you so much.

Karim

0 Likes
Message 5 of 18

hfcandrew
Advisor
Advisor

np

enjoy going down the mmapi rabbit hole

0 Likes
Message 6 of 18

drnunes
Explorer
Explorer

Hi
@hfcandrew  and @Anonymous 

I got a new notebook with Windows 10 Professional Edition Version 1909 installed and none of the scripts are working now. I don't know what's happening because at my Desktop (Home Edition 1809 version) I can get it work.

I Installed Python 2.7.16 32bit at c:\Python27 and verified that c:\Python27 and c:\Python27\Scripts were added to System Variables > PATH and Python is working as expected

When I import a bunny and run the code test.py nothing happens.

I downloaded mmAPI from github and downloaded from google drive link shared by @hfcandrew

At the folder extracted from github mmApi (c:\mm-api-master\distrib\python) I right clicked test.py > edit with IDLE
at IDLE I go to Run Menu and clicked Run Module
It shows an error
ImportError: No Module named _mmapi

Running test.py at the directory shared by hfcandrew I got another error
ImportError: DLL load failed: The specified module could not be found.

I read that installing SWIG could fix it
I don't know how to install SWIG. I downloaded swigwin-3.0.12, extracted the zip file to c:\Swig and added this directory to System Variables PATH.

That didn't work for me and I still get this error:

Python 2.7.16 (v2.7.16:413a49145e, Mar 4 2019, 01:30:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
==================== RESTART: C:\mm-api-hfcandrew\test.py ====================

Traceback (most recent call last):
File "C:\mm-api-hfcandrew\test.py", line 1, in <module>
import mmapi
File "C:\mm-api-hfcandrew\mmapi.py", line 26, in <module>
_mmapi = swig_import_helper()
File "C:\mm-api-hfcandrew\mmapi.py", line 22, in swig_import_helper
_mod = imp.load_module('_mmapi', fp, pathname, description)
ImportError: DLL load failed: The specified module could not be found.
>>>

What else can I do?

0 Likes
Message 7 of 18

hfcandrew
Advisor
Advisor

Very strange, it looks like the file "_mmapi.pyd" is not being found.

hfcandrew_0-1590581682662.png

I'd start by double checking to make sure they are all there.

0 Likes
Message 8 of 18

drnunes
Explorer
Explorer

The file "_mmapi.pyd" is on the folder
I thought about converting the py to an executable at the computer where everything works and use the executable instead of py on the new computer but I'm not a programmer and don't know how to use py2exe.

I tried to run on Windows 10 2004 released yesterday and it didn't work either. At Windows 10 1809 I can get it to work.

 

0 Likes
Message 9 of 18

mc_rees
Participant
Participant

Exactly the same problem, the same message as above! Trying to install on a fully updated Win10 laptop. I have already installed this on 3 machines about a year ago, without problems.
Any insight?
"Traceback (most recent call last):
File "C:\mm-api-hfcandrew\test.py", line 1, in <module>
import mmapi
File "C:\mm-api-hfcandrew\mmapi.py", line 26, in <module>
_mmapi = swig_import_helper()
File "C:\mm-api-hfcandrew\mmapi.py", line 22, in swig_import_helper
_mod = imp.load_module('_mmapi', fp, pathname, description)
ImportError: DLL load failed: The specified module could not be found.
>>>"

 

0 Likes
Message 10 of 18

hfcandrew
Advisor
Advisor

Not sure sorry. Are you using 32 bit python?

0 Likes
Message 11 of 18

mc_rees
Participant
Participant
yes, 32bit. I will try your python 3 setup and hope for the best.
0 Likes
Message 12 of 18

mc_rees
Participant
Participant

Finally solved! Had to install every MS Visual C++ Redistributable from 2005 to 2013. I am not sure which one did the trick, though.

0 Likes
Message 13 of 18

hfcandrew
Advisor
Advisor

That doesn't even make sense... but glad it worked.

0 Likes
Message 14 of 18

giovanni_martinezP9AMD
Community Visitor
Community Visitor

Hi all, 

Is there any documentation for this version of mmapi?

Best, 

Giovanni 

0 Likes
Message 15 of 18

hfcandrew
Advisor
Advisor

No sorry. Just the syntax needed to be changed on a few things. I can't remember what.

0 Likes
Message 16 of 18

guimrh
Observer
Observer

wow , as easy as that!!

thank you for your work!

0 Likes
Message 17 of 18

william_sikkema9QJMW
Observer
Observer

I followed these steps on a fresh install of windows 10, and could not get it running.  _MMAPI.PYD seems to be missing links to core DLLs. 

I have the same error as @mc_rees: _mod = imp.load_module('_mmapi', fp, pathname, description)
ImportError: DLL load failed: The specified module could not be found.

Installing the C++ redistributables has not helped me.


william_sikkema9QJMW_0-1726090467531.png



error.png

0 Likes
Message 18 of 18

william_sikkema9QJMW
Observer
Observer

Ok, So I went back and reinstalled all the C++ redistributable again, and I was missing two of them, so I can confirm that installing the redistros works.

0 Likes