JuneL
JuneL

Reputation: 11

error occured when install pyfmi in pip- is there any solution?

I'd like to install pyfmi but it kept failed.. I tried solutions on internet before, but nothing works.. would you give me solutions please??

(base) C:\Users\user>pip install pyfmi Collecting pyfmi Using cached PyFMI-2.5.tar.gz (4.8 MB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\user\AppData\Local\Temp\pip-install-l6733u74\pyfmi_8a142165ae444bbdb9d65b923602318f\setup.py", line 164, in raise Exception("FMI Library cannot be found. Please specify its location, either using the flag to the setup script '--fmil-home' or specify it using the environment variable FMIL_HOME.") Exception: FMI Library cannot be found. Please specify its location, either using the flag to the setup script '--fmil-home' or specify it using the environment variable FMIL_HOME. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

I tried PIP install

Upvotes: 1

Views: 405

Answers (1)

mrx
mrx

Reputation: 1

I had the same issue and all I can say is that I strongly advise you to not waste your time like I did trying to install every requirement by hand.

Use conda instead.

all you need to do is this:

First, Install anaconda :

https://www.anaconda.com/download

https://discuss.codecademy.com/t/setting-up-conda-in-git-bash/534473

Once that's installed on your prompt:

Creating the conda env:

  • conda create -n your_name_goes_here

  • conda activate your_name_goes_here

  • conda install python=3.6

  • conda config --add channels conda-forge

  • conda config --set channel_priority strict

  • conda install pyfmi

(thanks to conda forge https://github.com/conda-forge/pyfmi-feedstock)

if you're using visual studio code like me and want your packages to be recognized:

  • Open your project folder in VS Code.
  • Open the command palette with Ctrl+Shift+P
  • Type and select "Python: Select Interpreter".
  • VS Code will list available Python interpreters. Look for the one inside your Conda environment where PyFMI is installed. It will be something like:
  • ~/anaconda3/envs/your_environment_name/bin/python.exe
  • Additionally, you might want to make git bash your default terminal Change the default terminal in Visual Studio Code

Note: you will have to reinstall some packages you are using in your code. If you want to install any other package just insert conda install PACKAGE_NAME, but I should mention that I Faced some issues with some libraries while installing such as matplotlib but fixes are always available if you search well! https://github.com/ContinuumIO/anaconda-issues/issues/10949

I hope this works for you !

Upvotes: 0

Related Questions