Python conflict between FreeCAD and "cura"

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Conz
Posts: 14
Joined: Sun Apr 06, 2014 5:56 pm

Python conflict between FreeCAD and "cura"

Post by Conz »

Hi,

I want to use FreeCAD to construct parts for 3d-print. For printing I use an ultimaker2 with the free OSS "Cura".
After installing "FreeCAD 0.14.3389_x86_unstable_setup.exe 2014-04-05" there is a python problem with cura.
Both tools have its own python included. But the FreeCAD setup seems to set some python variables.

- I'm on Win7 64.
- No additional standalone python is installed.

After the FreeCAD installation I get following error on cura startup:

Code: Select all

C:\Program Files (x86)\Cura_14.03>.\cura.bat
Traceback (most recent call last):
  File "C:\Program Files (x86)\Cura_14.03\python\lib\runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name)
  File "C:\Program Files (x86)\Cura_14.03\python\lib\runpy.py", line 72, in _run_code exec code in run_globals
  File "C:\Program Files (x86)\Cura_14.03\Cura\cura.py", line 13, in <module> from Cura.util import profile
  File "Cura\util\profile.py", line 22, in <module>
    import numpy
  File "C:\Program Files (x86)\FreeCAD 0.14\bin\numpy\__init__.py", line 168, in <module>
    from . import add_newdocs
  File "C:\Program Files (x86)\FreeCAD 0.14\bin\numpy\add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:\Program Files (x86)\FreeCAD 0.14\bin\numpy\lib\__init__.py", line 8, in <module>
    from .type_check import *
  File "C:\Program Files (x86)\FreeCAD 0.14\bin\numpy\lib\type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "C:\Program Files (x86)\FreeCAD 0.14\bin\numpy\core\__init__.py", line 6, in <module>
    from . import multiarray
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
You can see cura is now using parts of python from "FreeCAD"?!

Is this a problem with the FreeCAD installer? (There is no archive without installer)
Or is this a problem by cura and should be reported there?
After uninstalling FreeCAD, cura is working again.

Could someone upload an actual developer build as an zip/7z without an installer?

EDIT:
The thread in the ultimaker forum:
http://umforum.ultimaker.com/index.php? ... -and-cura/
Last edited by Conz on Mon Apr 07, 2014 8:47 am, edited 1 time in total.
User avatar
quick61
Veteran
Posts: 3803
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: Python conflict between FreeCAD und "cura"

Post by quick61 »

Here -> viewtopic.php?f=4&t=6091 About as current as it comes without building your own.
This post made with 0.0% Micro$oft products - GOT LINUX?
User avatar
Conz
Posts: 14
Joined: Sun Apr 06, 2014 5:56 pm

Re: Python conflict between FreeCAD und "cura"

Post by Conz »

Thank you quick61. With this version I can run both software.
To compile my own version is a little bit to much for me. ;)

So it's a problem with the FreeCAD installer. This should be changed, maybe you don't have to set that python path with the installer?
wmayer
Founder
Posts: 20305
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Python conflict between FreeCAD und "cura"

Post by wmayer »

So it's a problem with the FreeCAD installer. This should be changed, maybe you don't have to set that python path with the installer?
But that's the problem. There were other users who explicitly wanted to have set this path when installing FreeCAD because this allows to import FreeCAD as Python module without setting sys.path.

Question: Does cura have its own version of numpy? Because it seems that somewhere inside cura numpy gets imported which then finds that version of the FreeCAD installation.But then a numpy module can't be loaded because a certain DLL is missing. So from this point of view it must be an installer problem because it lacks of one or more files. But the problem is not that we set this path in the registry.

The path is written in the registry under HKLM\Software\Python\PythonCore\2.6\PythonPath\FreeCAD 0.14.
User avatar
Conz
Posts: 14
Joined: Sun Apr 06, 2014 5:56 pm

Re: Python conflict between FreeCAD und "cura"

Post by Conz »

There is a numpy under Cura/python/Lib/

No reply to my thread in the ultimaker forum yet. I have to wait for some reaction of a cura developer.
Daid
Posts: 1
Joined: Mon Apr 07, 2014 1:14 pm

Re: Python conflict between FreeCAD und "cura"

Post by Daid »

wmayer wrote:Question: Does cura have its own version of numpy? Because it seems that somewhere inside cura numpy gets imported which then finds that version of the FreeCAD installation.But then a numpy module can't be loaded because a certain DLL is missing. So from this point of view it must be an installer problem because it lacks of one or more files. But the problem is not that we set this path in the registry.
Cura ships with numpy-1.6.2, and PortablePython 2.7.2.1, and doesn't install any registry keys.

IMHO, it's bad practice to install your "local" (FreeCAD) python path as "global" python paths.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Python conflict between FreeCAD and "cura"

Post by NormandC »

Welcome here, Daid.

For anyone wondering, Daid is the developer of Cura.
wmayer
Founder
Posts: 20305
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Python conflict between FreeCAD and "cura"

Post by wmayer »

IMHO, it's bad practice to install your "local" (FreeCAD) python path as "global" python paths.
What in your opinion is good practice? The reason why this registry key is added was a feature request that allows to import the FreeCAD Python module with e.g. a separately installed Python without the need to set sys.path beforehand.

And IMO the basic problem is not to set this registry key but an invalid installer that doesn't seem to include all required files. But nevertheless, I can check if it's possible to make the creation of the registry optional with the default to off.
wmayer
Founder
Posts: 20305
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Python conflict between FreeCAD and "cura"

Post by wmayer »

Setting the PythonPath is now deactivated by default.
User avatar
Conz
Posts: 14
Joined: Sun Apr 06, 2014 5:56 pm

Re: Python conflict between FreeCAD and "cura"

Post by Conz »

Thank you
Post Reply