Problems with installation

107 views
Skip to first unread message

Maxim Ryazanoff

unread,
Jan 11, 2020, 11:18:53 AM1/11/20
to FeResPost
Hello,

I have problem to install Python extension. I did everthing which is decscribed bu I still have problem with DLL.

What I do wrong?

Best regards,

RYAZANOV Maxim


Снимок.PNG
Снимок1.PNG
Снимок2.PNG
Снимок3.PNG
Снимок4.PNG
Снимок5.PNG
Снимок6.PNG

Maxim Ryazanoff

unread,
Jan 11, 2020, 7:52:26 PM1/11/20
to FeResPost
From description I understand that only pyd file is nexcessary for work of python extension. So which DLL cant be found?

FeResPost

unread,
Jan 12, 2020, 2:25:43 AM1/12/20
to FeResPost

Hello Maxim,

If you want to use FeResPost with Python, you need only the FeResPost.pyd file. (This file is basically a dll library of which the extension has been renamed to remind users that it is to be used with Python.) You do not need the libFeResPost.a and libFeResPost_4.5.3.dll ! (These libraries can be used only to compile other C++ programs with FeResPost.)

Now, when I am testing python scripts with FeResPost, I do not try to install FeResPost in Python installation directories. Instead, I launch Python via a batch file that configures the execution environment. For example, on my computer, I use PYTHON\EX01\readBdf.bat :
setlocal
call "../ENV/env.bat"
python readBdf.py
endlocal
in which ../ENV/env.bat contains :
set LIB=
set INCLUDE=
set PYTHONPATH=D:/SHARED/FERESPOST/SRC/OUTPUTS/PYTHON/PYTHON_37
set PATH=C:/NewProgs/PYTHON/PYTHON_37;C:/NewProgs/MINGW_3/bin

I made a test with a merged script like this :
setlocal
set PYTHONPATH=D:/SHARED/FERESPOST/SRC/OUTPUTS/PYTHON/PYTHON_27
set PATH=C:/NewProgs/PYTHON/PYTHON_27
python readBdf.py
endlocal
and it works !

In this last script, PYTHONPATH variable points to the directory contains FeResPost.pyd file. PATH is set to directory containing Python executable. (PATH and PYTHONPATH variables will have to be modified to match your computer installation.)

I believe that the PYTHONPATH variable can also be defined in user environment variables. But it has to point to the directory pointing to FeResPost.pyd file.

According to what I see in your images:
  • You need only one copy of the FeResPost.pyd file.
  • You do not need the libFeResPost.a and libFeResPost_4.5.3.dll files.
  • PYTHONPATH variable should contain the directory in which you have copied FeResPost.pyd file.
  • Make sure that your are using the version of library matching your Python executable (matching version number and 32bits/64bits).
  • It is probably possible to output the Python search path in the script, before trying to load FeResPost library. I suggest you do it to make sure that search path is OK.
  • You might also need to restart your Python IDE after changing environment variables, to make sure changes are taken into account.
I suggest you first try with the batch files approach, and afterwards with your IDE.

Regards,

Renaud


Maxim Ryazanoff

unread,
Jan 12, 2020, 4:30:40 AM1/12/20
to FeResPost
  • You need only one copy of the FeResPost.pyd file. ==> Done. I keep it only in C:\Users\User\AppData\Roaming\Python\Python37\site-packages\FeResPost
  • You do not need the libFeResPost.a and libFeResPost_4.5.3.dll files. ==> Done. I deleted them
  • PYTHONPATH variable should contain the directory in which you have copied FeResPost.pyd file. ==> Done. I made modification in system and user variable (see s1 and s2 pictures).
  • Make sure that your are using the version of library matching your Python executable (matching version number and 32bits/64bits). ==> My version is x64. I downloaded "FeResPost_win64_4.5.3.7z"
  • It is probably possible to output the Python search path in the script, before trying to load FeResPost library. I suggest you do it to make sure that search path is OK. ==> done and it is OK
readBdf.bat:

setlocal
call C:/Users/User/Documents/CSV/TEst/env.bat
python readBdf.py
endlocal

env.bat:

set LIB=
set INCLUDE=
set PYTHONPATH=C:/Users/User/AppData/Roaming/Python/Python37/site-packages/FeResPost
set PATH=C:/Users/User/AppData/Local/Programs/Python/Python37;C:/Users/User/Documents/CSV/TEst


readBdf.py:

import os
print(os.environ.get("PYTHONPATH")) ==> it gives in result "C:/Users/User/AppData/Roaming/Python/Python37/site-packages/FeResPost" and this folder contain "FeResPost.pyd"
import FeResPost
  • You might also need to restart your Python IDE after changing environment variables, to make sure changes are taken into account. ==> No it doesnt help.
As you can see in the attached screen s3 actions done havent solved my problem. Maybe you have other ideas?
s1.PNG
s2.PNG
s3.PNG
s4.PNG

FeResPost

unread,
Jan 12, 2020, 5:18:13 AM1/12/20
to FeResPost

Hi Maxim,

I have done a few tests on my computer. Actually, I have also a problem with Python! This problem does not seem related to the version of Python or FeResPost.

So, I need to investigate.

It could take some time...

Renaud

FeResPost

unread,
Jan 12, 2020, 12:22:43 PM1/12/20
to FeResPost
Hi Maxim,

I think I have the explanation.

The loading of FeResPost.pyd fails because some compiler shared libraries cannot be found. I just posted new archives containing compiler re-distributable libraries in directory "OUTPUTS/REDISTR". Your path environment variable should contain this directory.

On my comuter, this script works :
setlocal

set PYTHONPATH=D:/SHARED/FERESPOST/DISTRCOMPIL/GPP_NATIVE_64/OUTPUTS/PYTHON/PYTHON_37
set PATH=C:/NewProgs/PYTHON/PYTHON_37_64;D:/SHARED/FERESPOST/DISTRCOMPIL/GPP_NATIVE_64/OUTPUTS/REDISTR

python --version
python readBdf.py
endlocal
sleep 3
(PATH contains one directory for PYTHON executable, and one for the redistributable dlls.)

A confess that I did not test Python examples with the last distribution of FeResPost 1st January. Otherwise I would have identified the problem.

With earlier versions, the g++ compiler directory was in my PATH varaible, so that I did not need to point to the REDISTR directory, and I had no problem. What surprises is that no one notified me of a problem, and I am sure that some people have faced it!

So I thank you for your question, and I hope you can run your examples with new binaries. (Do not hesitate to ask more question if you still have problems.)

The new binaries are available in "LATEST_DEV/DISTR_20200112" part of binaries download section.

Regards,

Renaud




Message has been deleted

Maxim Ryazanoff

unread,
Jan 12, 2020, 3:52:40 PM1/12/20
to FeResPost
Your last answer helped me to solve the issue. Thanks a lot!

FeResPost

unread,
Jan 19, 2020, 1:44:27 AM1/19/20
to FeResPost

Hi Maxim,

I recompiled yesterday FeResPost on Windows with new options. On my computer, I no longer need to include the "REDISTR" directory in PATH environment variable.

The new binaries are available in "LATEST_DEV/DISTR_20200118" part of binaries download section.

Regards,

Renaud

Victor Santibañez

unread,
Jul 27, 2020, 8:28:45 AM7/27/20
to FeResPost
Dear Renaud,

My name is Victor and I've been trying to run the first examples of FeResPost for several days without success. I attach some pictures for you to see the errors I get.

I've followed this thread's advises, as well as the ones given in the manual and I could not get the first example running in PyCharm in neither of the two computers I tried it.

I would love if you could upload a video showing how to make the first example run, because I've spent so much time trying all the posibilities of directories, interpreters,... and still haven't figured it out. I did succeed in making the EX06 excel file running with the video you uploaded a few years ago, but I don't know if the registration of the COM component has anything to do with the EX01 I'm trying to run in Python.


Below I ask you some of the questions I've come across during these days:

- Why are there both COM and Python examples inside SRC, TESTSAT and Binaries folders? Do I need to run COM or Python folders inside PyCharm? I don't understand what's the difference between them if both are opened in PyCharm.

- Does the directory of the TESTSAT files need to be without spaces?

- Which directories do I have to modify in order to run the first example? Just the two include statements in unit_xyz_V1.bdf and the env.bat paths? Or also unit_xyz_V1.bdf.WINDOWS and lst? In the photo s3 of Maxim, the directories are the ones that ubicate his files, which I don't know if the lst file has to be changed manually, or it's the result of running a script.

- I don't understand why the two include directories that has to be modified in unit_xyz_V1.bdf are divided in three lines (photo 4). And related with my previous question of the spaces in the directories, I think that those include statements in the .bdf file, doesn't take into account the spaces, which can lead to errors of not finding the files (photo 3). If tried having a directory without spaces and the errors persist.

- Can I execute FeResPost in the prompt? As you can see in photo 14, I can import FeResPost. I think I also can import FeResPost in PyCharm (first photos), because I get the square made of ****, but then I get various errors for some reason. So I think that the error in my examples is related with the directories or with the interpreter.

- Do I have to change the directories for every example?

- Why isn't it a .pyd file for Python 3.8?

- Do I have to install Python 3.7 appart from Anaconda? As you can see in photos 6-8, I have both python and FeResPost in the corresponding locations, which I have specified in photo 5, so I think it's not necessary. In the other computer I've tried, I've Python 3.7 both in "C:\ProgramData\Anaconda3" and in "C:\Users\victor.santibanez\AppData\Local" and none works.

- I've tried both the versions of binaries 32 and 64 bits and I get the same errors. As you can see in photo 14, the Python version I'm using is 32 bits, but then I can't find the FeResPost library in photo 9 or 10.

- I've also thought that in other to avoid changing the directories, I could make a partition of the hard disk called "D:\SHARED\FERESPOST\" to replicate the directories you have. Would it be easier that way? However, I think that it's not necessary to go that far, and that it can work without making that.


I'd love to hear some advises from you about how to run FeResPost because I've the time and the will to learn it.

Thank you very much.

Best regards,
Victor

Victor Santibañez

unread,
Jul 27, 2020, 8:29:32 AM7/27/20
to FeResPost
2.png
11.png
12.png
13.png
14.png
1.png
3.png
4.png
5.png
6.png
7.png
8.png
9.png
10.png

Renaud Sizaire

unread,
Jul 27, 2020, 9:53:44 AM7/27/20
to fere...@googlegroups.com
Hi Victor,

This is quite a long list of questions. You are lucky I am at home today, so that I can answer the questions directly.

Please note that each Python example comes with a batch file with ".bat" extension that you can use to run the example on Windows, or a Bash file, to run on Linux. I do not use PyCharm to run examples or another kind of IDE, and I will not try to answer questions related to these kinds of environments. I assume that you will run the examples with a plain and simple Python. You will have to modify the Batch/Bash file to match you installation however (redefine access paths).

The first examples in EX01 directory illustrate the reading of Nastran models by FeResPost. Several variants of BDF files are proposed to demonstrate the robustness of the readBdf method. For example, includes with absolute/relative paths, includes split on several lines, with space characters... I wanted FeResPost to be able to read with a reasonable probability of success a BDF that complies with the rules defined in Nastran QRG.

The "unit_xyz_V1.bdf.WINDOWS" and "unit_xyz_V1.bdf.LINUX" files in "EX01" directory differ by the the absolute paths which can not be the same on the two OSs. (I keep the two files in the directory to switch easily from the one to the other.)

Now, about your example :
  • If the output shows the heading with FeResPost version, it means that you managed to load the Python extension. There you are OK.
  • You also succeed to create a NastranDb object to open the BDF file with the readBdf method.
  • But you fail the first include statement in BDF file...
  • When I saw the images you annexed to you message, I had an idea of what was going wrong and I made a few tests to check. The problem is that you are using non standard characters in the directory names. I meas you are using accentuated characters like "á" or "ó". Indirectly, it fails because you are Spanish!
  • I made a few tests after renaming directory "TESTSAT" in "TESTSAT_modifié" and I have the same kind of problem.
  • Now, is this a FeResPost bug? I think no! Nastran has the same problem. Even with relative includes that avoid the accentuated directory names, Nastran has problems because at some moment, an absolute path name containing accentuated characters is generated and cannot be managed.

So the rule should be "avoid accentuated characters in file and directory names at all levels, even if you work with relative paths".

Now, answers for other questions:

    • Why are there both COM and Python examples inside SRC, TESTSAT and Binaries folders?
      • FeResPost is distributed as a compiled library that can be a Ruby extension, a Python complement, a COM component or a .NET assembly. Depending on what you do, you will use one ot hese four types of library, but they are mutually exclusive. With Python, you need to use the appropriate FeResPost.pyd file. But you have loaded FeResPost in your first example, so you are fine.
    • Does the directory of the TESTSAT files need to be without spaces?
      • I do not think so, but I am not sure. In general I avoid space characters in directory or file names and replace them by underscore "_" characters.
    • Which directories do I have to modify in order to run the first example?...
      •  See above.
    • I don't understand why the two include directories that has to be modified in unit_xyz_V1.bdf are divided in three lines (photo 4)...
      • See above.
    • Can I execute FeResPost in the prompt?
      • Yes, I think you already succeeded to load FeResPost.
    • Do I have to change the directories for every example?
      • No, only the first example uses absolute paths to check the capabilities of FeResPost. Most of the other examples use relative paths only and should be easier to run.
    • Why isn't it a .pyd file for Python 3.8?
      • Because I did not compile a library for latest version of Python. Maybe this will be done for version 4.5.8 of FeResPost.
    • Do I have to install Python 3.7 appart from Anaconda?
      • I do not use Anaconda, and I am not a big user of Python. So I prefer not to answer this question.
    • I've tried both the versions of binaries 32 and 64 bits and I get the same errors.
      • If the error is related to accentuated characters in directory names, it seems normal.
    • I've also thought that in other to avoid changing the directories, I could make a partition of the hard disk called "D:\SHARED\FERESPOST\" to replicate the directories you have.
      • Not such a bad idea... It would have worked. Just avoid accentuated characters.

    Regards,

    Renaud








    Le 27-07-20 à 14:29, Victor Santibañez a écrit :
    --
    You received this message because you are subscribed to the Google Groups "FeResPost" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ferespost+...@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ferespost/3b94931a-7669-4051-8588-e73a3136c2a4o%40googlegroups.com.


    Victor Santibañez

    unread,
    Jul 27, 2020, 10:34:11 AM7/27/20
    to FeResPost
    Thank you very much!

    I finally got it!
    1.png
    2.png

    Alfred Aoude

    unread,
    Aug 4, 2020, 5:48:04 PM8/4/20
    to fere...@googlegroups.com
    Hi Renaud,
    Can you please give me an example on how to create and add a coordinate system to a nastran database.
    I am using C# and FeResPost library 4.5.6.0

    I create a nastran db using NastranDb I read a bdf using db.readBdf.
    I then proceed to create a coordinate system using

    CoordSys Sys=new CoordSys();
    Sys.initWith3Points(“CORDR”,db, 0,A,B,C) //ABC are float[3] each.
    Sys.id=100;
    db.addCoordSys(Sys);

    it looks like it worked. I can check if the coordinate exists and I get true from db.checkCoordSysExists but I cannot access it. It fails on
    db.fillCard(“CoordSys”, 100);

    Can you please point me int the right direction.
    You can email text or call me
    206-375-6417

    Thanks
    Alfred

    Renaud Sizaire

    unread,
    Aug 5, 2020, 3:16:58 AM8/5/20
    to fere...@googlegroups.com
    Hi Alfred,

    I had to make a few checks to answer your question. I made them with Python but the solution I propose should work with C# too.

    The reason why the "fillCard" call does not work in your case is that the CoordSys object you are creating is a generic "CORDR" coordinate system. It is not a Nastran CORD2R or CORD1R. In FeResPost User Manual, the generic CoordSys object is presented in Part I of the manual and is not related to a particular solver like Nastran or Samcef (Part III of the manual). This explains why the CoordSys objet cannot be translated to a Nastran card. It can however be inserted in NastranDb object, and used for coordinate system transformations of Results.

    If you really need to create a Nastran coordinate system and insert it in the database, you can use the "insertCard" method. In Python, the following statements works:
    card=["CORD2R",998,0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0]
    db.insertCard(card)
    db.makeAllCoordSysWrt0()
    newCard=db.fillCard("CoordSys",998)
    print(newCard)
    db.writeBdfLines("test.bdf","w","right","short","All")
    In test.bdf, we find the definition of CS 998. Note that in this example, we do the reverse of the code you show in your mail, but I presume it is no problem.

    Note also that Nastran defines "CORD1R" or "CORD2R" objects, but no "CORDR". I realize that FeResPost is poor as far as the manipulation of coordinate systems is concerned. I will try to add a method allowing the identification of CS type and improve the User Manual.

    Regards,

    Renaud


    Alfred Aoude

    unread,
    Aug 31, 2020, 2:32:25 PM8/31/20
    to fere...@googlegroups.com
    Thank you for the quick reply. Sorry I was away and I didn’t have a chance to reply sooner. 



    Sent from my iPhone

    On Aug 5, 2020, at 12:16 AM, Renaud Sizaire <r6ra.fe...@proximus.be> wrote:

    
    --
    You received this message because you are subscribed to the Google Groups "FeResPost" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ferespost+...@googlegroups.com.
    Reply all
    Reply to author
    Forward
    0 new messages