Out-of-Box Installation on Windows

3 posts / 0 new
Last post
Joined: 2016-06-17
Out-of-Box Installation on Windows


I tried to install JModelica.org 2.0 on my Windows 10 x64 bit machine.  After installation I tried to run the example files to test the installation and get the error below.  I tried the installation twice: 1) having python 2.7.13 x32 installed on my machine and 2) not having python installed on my machine.  I get the same error both times.

I've read in some forums online that this error could be caused by scomething with scipy, which may require a special package of numpy (+mkl) or the use of Anaconda to organize the installation of scipy.  I'd prefer a clean install without using a special numpy package or without requiring to install and organize the whole Anaconda suite.

Has this issue been run into before?  If so, what is the cleanest fix?

Thanks for the help!



In [1]: from pyfmi.examples import fmi_bouncing_ball
ImportError                               Traceback (most recent call last)
<ipython-input-1-61c9799e653e> in <module>()
----> 1 from pyfmi.examples import fmi_bouncing_ball

C:\JModelica.org-2.0\install\Python\pyfmi\__init__.py in <module>()
     24 from .fmi import FMUModel, load_fmu, FMUModelME1, FMUModelME2
     25 from .fmi import FMUModelCS1, FMUModelCS2
---> 26 from .master import Master
     27 from .fmi_extended import FMUModelME1Extended
     28 import numpy as N

src\pyfmi\master.pyx in init pyfmi.master (src\pyfmi\master.c:48286)()

C:\JModelica.org-2.0\install\Python\pyfmi\fmi_algorithm_drivers.py in <module>()
     27 import pyfmi
     28 import pyfmi.fmi as fmi
---> 29 import pyfmi.fmi_extended as fmi_extended
     30 from pyfmi.common.algorithm_drivers import AlgorithmBase, AssimuloSimResult, OptionBase, InvalidAlgorithmOptionException, InvalidSolverArgumentException, JMResultBase
     31 from pyfmi.common.io import ResultDymolaTextual, ResultHandlerFile, ResultHandlerMemory, ResultHandler, ResultHandlerDummy, ResultHandlerCSV, ResultCSVTextual

src\pyfmi\fmi_extended.pyx in init pyfmi.fmi_extended (src\pyfmi\fmi_extended.c:11727)()

C:\JModelica.org-2.0\install\Python\pyfmi\simulation\assimulo_interface.py in <module>()
     29 import time
---> 31 from pyfmi.common.io import ResultWriterDymola
     32 import pyfmi.fmi as fmi
     33 from pyfmi.common import python3_flag

C:\JModelica.org-2.0\install\Python\pyfmi\common\io.py in <module>()
     25 import numpy as N
---> 26 import scipy.io
     28 from . import xmlparser

C:\JModelica.org-2.0\Python27\lib\site-packages\scipy\io\__init__.py in <module>()
     96 # matfile read and write
---> 97 from .matlab import loadmat, savemat, whosmat, byteordercodes
     99 # netCDF file support

C:\JModelica.org-2.0\Python27\lib\site-packages\scipy\io\matlab\__init__.py in <module>()
     12 # Matlab file read and write utilities
---> 13 from .mio import loadmat, savemat, whosmat
     14 from . import byteordercodes

C:\JModelica.org-2.0\Python27\lib\site-packages\scipy\io\matlab\mio.py in <module>()
     10 from scipy._lib.six import string_types
---> 12 from .miobase import get_matfile_version, docfiller
     13 from .mio4 import MatFile4Reader, MatFile4Writer
     14 from .mio5 import MatFile5Reader, MatFile5Writer

C:\JModelica.org-2.0\Python27\lib\site-packages\scipy\io\matlab\miobase.py in <module>()
     20     byteord = ord
---> 22 from scipy.misc import doccer
     24 from . import byteordercodes as boc

C:\JModelica.org-2.0\Python27\lib\site-packages\scipy\misc\__init__.py in <module>()
     49 from .common import *
     50 from numpy import who, source, info as _info
---> 51 from scipy.special import comb, factorial, factorial2, factorialk
     53 import sys

C:\JModelica.org-2.0\Python27\lib\site-packages\scipy\special\__init__.py in <module>()
    625 from __future__ import division, print_function, absolute_import
--> 627 from ._ufuncs import *
    629 from .basic import *

ImportError: DLL load failed: The specified module could not be found.

Joined: 2016-06-17

From the scipy.org website, they suggest the easiest way to install scipy is through python package managers such as Anaconda or similar.  They offer an alternative solution to use pre-built Windows .whl files from this website: http://www.lfd.uci.edu/~gohlke/pythonlibs/.  There, the numpy-1.13+mkl installation is required.  In the end, I used with the .whl files from that website:

pip install --user numpy‑1.13.1+mkl‑cp27‑cp27m‑win32.whl

followed by

pip install --user scipy‑0.19.1‑cp27‑cp27m‑win32.whl

This successfully installed scipy v0.19.  Then, I started JModelica.org 2.0 from the start menu in a python prompt and the examples (bouncing ball and cstr optimization) worked.

From my experience, the two options to get JModelica.org 2.0 working on Windows is 1) to also install a package manager like Anaconda or 2) to go about manually installing the scipy package .whl via numpy+mkl .whl.  I'm wondering if this is the experience by others, including developers at Modelon.  Also, if this is the experience, should Anaconda be added as a requirement in the install instructions, or how should this be handled?



Joined: 2015-02-06
JModelica and Conda Environment

I came across this post while try to do what seems like a similar thing so I thought I would post what worked for me.

  1. Install JModelica (I installed version 2.1)
  2. In the Anaconda Navigator create a new environment named "jmod" with the Python 2.7 packages
  3. Add the channel "conda-forge" (this contained "jpype" which seemed to be needed)
  4. Install the following packages for the new environment:
    • numpy
    • scipy
    • jpype1
    • nose
    • lxml
    • cython
    • assimulo
  5. As per: https://conda.io/docs/user-guide/tasks/manage-environments.html#windows I added the environment variable setup script for JModelica:
    • Add the folders ./etc/conda/activate.d and ./etc/conda/deactivate.d to the "envs/jmod" environment folder in the Anaconda2 installation folder
    • Add the env_vars.bat file to the activate.d folder with the following contents to set the PYTHON_HOME variable and call the setenv.bat file from the JModelica installation.

@echo off
set PYTHON_HOME=C:\Users\jbg\Anaconda2\envs\jmod
call C:\programs\JModelica\2.1\setenv.bat

I just used the default versions of the above Python packages which seemed to work.  It might have been better to use the versions supported by JModelica.  Anyway, I was able to compile and simulate a Modelica model.

Login or register to post comments