Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

execution error #51

Open
ninja7v opened this issue Apr 6, 2021 · 12 comments
Open

execution error #51

ninja7v opened this issue Apr 6, 2021 · 12 comments

Comments

@ninja7v
Copy link

ninja7v commented Apr 6, 2021

I installed ToPy successfully on Windows, but when I try to execute it with the example "python .\optimise.py .\beam_2d_reci_10_iters.tpd" I keep having the error : IOError: [Errno 2] No such file or directory: 'C:\Users\LPT14\Anaconda3\envs\py27\lib\site-packages\topology_optimization-0.4.0-py2.7.egg\topy\data\Q4bar.K'
I tried on 2 computers and I have the problem on both.
Did I do anything wrong? Thanks for your help.

@williamhunter
Copy link
Owner

Hi,

What is in your folder "C:\Users\LPT14\Anaconda3\envs\py27\lib\site-packages\topology_optimization-0.4.0-py2.7.egg\topy\data"?

@ninja7v
Copy link
Author

ninja7v commented Apr 6, 2021 via email

@williamhunter
Copy link
Owner

williamhunter commented Apr 6, 2021

You can see that you don't have the Q4bar.K file.

What version of Python are you using?

What version of Topy did you install?

@ninja7v
Copy link
Author

ninja7v commented Apr 6, 2021

I picked Topy-master and Topy-0.4.1 but I get the error on both.
I am using Python 2.7.18 on a virtual environment with Conda.

@williamhunter
Copy link
Owner

williamhunter commented Apr 6, 2021 via email

@ninja7v
Copy link
Author

ninja7v commented Apr 6, 2021

Yes I did.

@williamhunter
Copy link
Owner

Hmmm. I haven't looked at this in a few years. Give me some time and I'll investigate

@ninja7v
Copy link
Author

ninja7v commented Apr 6, 2021

Sure. Thanks a lot for your commitment.
Just in case, here is the full output after I submitted the command:
It seems as though all or some of the element stiffness matrices
do not exist. Creating them...
This is usually only required once and may take a few minutes.
SymPy is integrating: K for Q4bar...
Created C:\Users\LPT14\Anaconda3\envs\py27\lib\site-packages\topology.K (stiffness matrix).
Traceback (most recent call last):
File ".\optimise.py", line 8, in
import topy
File "C:\Users\LPT14\Anaconda3\envs\py27\lib\site-packages\topology_optimization-0.4.0-py2.7.egg\topy_init_.py", line 8, in
from .topology import *
File "C:\Users\LPT14\Anaconda3\envs\py27\lib\site-packages\topology_optimization-0.4.0-py2.7.egg\topy\topology.py", line 16, in
from .parser import tpd_file2dict, config2dict
File "C:\Users\LPT14\Anaconda3\envs\py27\lib\site-packages\topology_optimization-0.4.0-py2.7.egg\topy\parser.py", line 14, in
from .elements import *
File "C:\Users\LPT14\Anaconda3\envs\py27\lib\site-packages\topology_optimization-0.4.0-py2.7.egg\topy\elements.py", line 48, in
Q4bar = load(fname)
File "C:\Users\LPT14\Anaconda3\envs\py27\lib\site-packages\numpy\lib\npyio.py", line 422, in load
fid = open(os_fspath(file), "rb")
IOError: [Errno 2] No such file or directory: 'C:\Users\LPT14\Anaconda3\envs\py27\lib\site-packages\topology_optimization-0.4.0-py2.7.egg\topy\data\Q4bar.K'

@Bassarey
Copy link

Bassarey commented Jun 4, 2021

Hello, my problem

PS C:\users\admin\Documents\topy\scripts> python optimise.py inverter_3d_etaopt_gsf_dquad.tpd
Traceback (most recent call last):
File "optimise.py", line 8, in
import topy
File "C:\Python27\lib\site-packages\topy_init_.py", line 8, in
from .topology import *
File "C:\Python27\lib\site-packages\topy\topology.py", line 14, in
from pysparse import superlu, itsolvers, precon
File "C:\Python27\lib\site-packages\pysparse_init_.py", line 6, in
from numpy._import_tools import PackageLoader
ImportError: No module named _import_tools

PS C:\users\admin\Documents\topy\scripts> pip list
Package Version


backports.functools-lru-cache 1.6.4
cycler 0.10.0
kiwisolver 1.1.0
matplotlib 2.2.5
mpmath 1.2.1
numpy 1.16.6+mkl
pip 19.2.3
pyparsing 2.4.7
pysparse 1.3
python-dateutil 2.8.1
pytz 2021.1
PyVTK 0.5.18
setuptools 44.1.1
six 1.16.0
sympy 1.5.1
ToPy 0.3.2

@shushu-qin
Copy link

In my case, the problem came from np.load in elements.py. I solved this problem by modifying the load function in elements.py file, which is change load(fname) to load(fname, allow_pickle=True). In this way, it can successfully load the stiffness file.

@Liyaguan
Copy link

allow_pickle=True

didn't work

@7over4
Copy link

7over4 commented Mar 19, 2023

Found a way, basically you need the missing .K "stiffness matrix" files. For some reason they are not generated during setup.py installation. I got them generated and I'm hosting them on my site sasserisop.com/topyKFiles.zip There is 7 of them you will need. Place these files under C:\Users\YOURUSERNAME\anaconda3\envs\py27\Lib\site-packages\topology_optimization-0.4.0-py2.7.egg\topy\data There is one more thing I had to do before I got it to work and that is to allow_pickle=True like shushu-qin mentioned, to do this: under the same directory with the .K files, go back up one directory and you will find elements.py From there, edit it with your text editor and change every instance of load(fname) to load(fname, allow_pickle=True). Now to test, open a terminal under the py27 environment you created, (this is assuming you went through the installation steps in github.com/williamhunter/topy/releases/tag/0.4.1). Now cd to the optimise.py file, in my case, type: cd C:\Users\YOURUSERNAME\Desktop\topy-0.4.1\scripts Now type: python .\optimise.py ../examples/mbb_beam/beam_2d_reci_10_iters.tpd If everything above was done correctly this will generate 10 iterations for the given tpd file and spit out the results in the same directory optimise.py is in. Hooray! Now all we need is a new fixed release for the masses. I might add a pull request :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants