Solid-Mechanics / matplotlib-4-abaqus

allow abaqus(v6.14-1) to use matplotlib in its build-in python scripts environment.
MIT License
44 stars 26 forks source link

Is it possible to do the same on Linux? #2

Open caiuamelo opened 9 years ago

caiuamelo commented 9 years ago

I have tried to do so, on Ubuntu 15.04. I got an error message:

"Traceback (most recent call last): File "", line 1, in File "SMAPython/SMAPytLibPy.m/src/site.py", line 120, in _numpyHook File "/opt/abaqus/6.14-1/tools/SMApy/python2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 27, in import matplotlib.colorbar File "SMAPython/SMAPytLibPy.m/src/site.py", line 120, in _numpyHook File "/opt/abaqus/6.14-1/tools/SMApy/python2.7/lib/python2.7/site-packages/matplotlib/colorbar.py", line 32, in import matplotlib.artist as martist File "SMAPython/SMAPytLibPy.m/src/site.py", line 120, in _numpyHook File "/opt/abaqus/6.14-1/tools/SMApy/python2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 12, in from .transforms import Bbox, IdentityTransform, TransformedBbox, \ File "SMAPython/SMAPytLibPy.m/src/site.py", line 120, in _numpyHook File "/opt/abaqus/6.14-1/tools/SMApy/python2.7/lib/python2.7/site-packages/matplotlib/transforms.py", line 39, in from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox, File "SMAPython/SMAPytLibPy.m/src/site.py", line 120, in _numpyHook ImportError: No module named _path"

X-G commented 9 years ago

I don't have a Linux computer and didn't test this on Linux.

Actually, you can try the following:

  1. install a python environment in Linux and install matplotlib module(using pip for example)
  2. copy the following module from the external python environment to abaqus python environment:
    • matplotlib
    • dateutil
    • six
    • pyparsing

Basically this was what I had done on windows to make this works. Let me know if this works or not on Linux.

X-G commented 9 years ago

I installed unbuntu on my laptop and but it doesn't work. It seems that abacus build-in python cannot find some module due to the lack of _init_.py file. Let me know if you have some news about this.@caiuamelo

caiuamelo commented 9 years ago

Actually, I followed your steps, but it didn't work. I got the same error that i told in the previous message. So, i have no progress yet. I'm sorry =(.

X-G commented 9 years ago

There is an alternative called abapy. But it seems not easy enough to use. Maybe you can try that solution.

caiuamelo commented 9 years ago

Sorry for the delay to answer, i have read the Abapy documentation, and it seems to be a fancier solution to deal with post processing in Abaqus. Although it is necessary to use Abaqus Python and system Python with matplotlib to plot the data. Do you have any progress in this issue @X-G ?

X-G commented 9 years ago

@caiuamelo Sorry I don't have progress regards with this issue. I think the problem is abaqus python has some issue to import the matplotlib modules due to the problem of _init_.py file. Because I'm not very familiar with python, I cannot solve this problem. I'm waiting for the new version of Abaqus 2016, which should be released at the end of this year. I hope the new version would upgrade the build-in python, hopefully the problem would be solved.

X-G commented 7 years ago

opened an issue on Matplotlib project: github/matplotlib/matplotlib#7450

X-G commented 7 years ago

Hi @caiuamelo, I find a clue why it doesn't work on Linux platform. I found that on windows platform, Abaqus 6.14 ONLY works with matplotlib version 1.3.1 or earlier. version 1.4.x and 1.5.x don't work. But when I install matplotlib version 1.3.1 on ubuntu via pip, there is always a error. Do you have any clue how to install matplotlib version 1.3.1 on ubuntu?

youngung commented 7 years ago

Hi @caiuamelo @X-G Instead of the method of @X-G, an alternative is that add the local python site package path to your environment variable $PATH in Abaqus Python. This method has been working well for me to use matplotlib nicely in Abaqus on both Linux/Mac.

The method is quite simple:

import os
path_site_packages='/home/younguj/anaconda2/lib/python2.7/site-packages/'
os.sys.path.append(path_site_packages)

I have a few examples where I use my personal and other third party packages including NumPy on Abaqus Python. If you are interested, find a few examples in my repo, particularly this one which is to generate a flat uniaxial tensile specimen.

Youngung

X-G commented 7 years ago

Many thanks @youngung , I thinks I have tried this method, not using anaconda2, but using ubuntu system build in python. It didn't work. I cannot access my ubuntu machine right now, I will try your method later tonight. This is a very exciting news for me to know that this problem can be solved. Do you using x window forwarding to use abaqus on Mac?

Xiaojun

youngung commented 7 years ago

I’d be very glad if you can resolve the issue. So please let me know if the method isn’t working for you.

I lost my access to the Linux system where I used the X window for Abaqus on Mac - I recently moved to a new position. Now I’m still struggling with Abaqus installation with my Linux here at my new work. So if you can help me with this, I’d be very glad.

Youngung

On 3 Jan 2017, at 11:03 PM, Xiaojun GU notifications@github.com wrote:

Many thanks @youngung https://github.com/youngung , I thinks I have tried this method, not using anaconda2, but using ubuntu system build in python. It didn't work. I cannot access my ubuntu machine right now, I will try your method later tonight. This is a very exciting news for me to know that this problem can be solved. Do you using x window forwarding to use abaqus on Mac?

Xiaojun

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Solid-Mechanics/matplotlib-4-abaqus/issues/2#issuecomment-270120405, or mute the thread https://github.com/notifications/unsubscribe-auth/AAtgtQSp2RPBSA8V8YZsGk8-N2ABJXQyks5rOlUwgaJpZM4F0SOQ.

X-G commented 7 years ago

@youngung , I just tried your method on Windows 7, it works fine. I will let you know after I try it on Ubuntu.

I'm very glad if I can give you some help on your installation problem. Could you tell me what's the problem?

-------------add--------------- It turns out that I didn't delete mpl module added by my own when I tested for the first time. It have some issues when using @youngung 's approach on Windows 7 right now.

youngung commented 7 years ago

Glad to hear that it worked on your Windows 7. For my problem, it’s a bit too late for me to discuss it - it’s 11pm where I’m ;) I’ll reply when I’m at it tomorrow (or maybe later this week).

Youngung

On 3 Jan 2017, at 11:18 PM, Xiaojun GU notifications@github.com wrote:

@youngung https://github.com/youngung , I just tried your method on Windows 7, it works fine. I will let you know after I try it on Ubuntu.

I'm very glad if I can give you some help on your installation problem. Could you tell me what's the problem?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Solid-Mechanics/matplotlib-4-abaqus/issues/2#issuecomment-270123499, or mute the thread https://github.com/notifications/unsubscribe-auth/AAtgtTj-SAzvqF3r3pSQ5WNTdGuDU1Krks5rOljDgaJpZM4F0SOQ.

X-G commented 7 years ago

@youngung OK, no problem.

caiuamelo commented 7 years ago

Great! I will try it soon @youngung.

Thanks, Caiuã.

ps: Tell us your Abaqus installation problem later, maybe we can help,

X-G commented 7 years ago

I tried on Ubuntu, not work, following error pop out:

ImportError: numpy.core.multiarray failed to import
File "/home/xiaojun/abaqustemp/matplotlib_test.py", line 13, in <module>
    import matplotlib.pyplot as plt

File "/home/xiaojun/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py", line 24, in <module>
    import matplotlib.colorbar
File "/home/xiaojun/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py", line 27, in <module>
    import matplotlib.artist as martist
File "/home/xiaojun/anaconda/lib/python2.7/site-packages/matplotlib/artist.py", line 8, in <module>
    from transforms import Bbox, IdentityTransform, TransformedBbox, \
File "/home/xiaojun/anaconda/lib/python2.7/site-packages/matplotlib/transforms.py", line 35, in <module>
    from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
youngung commented 7 years ago

I am not sure what caused the error exactly. I just briefly googled around a bit and I found similar failures of ‘numpy.core.multiarray’ when there are two versions of NumPy existing on the system. If you google a bit, I guess you’ll find similar discussions where people recommend upgrade NumPy correctly.

Not sure if this resolves your issue but I guess it is worth trying to check the version of the NumPy.

For your information, I have strictly used Anaconda when install NumPy, MPL and all.

Youngung

On 4 Jan 2017, at 3:22 AM, Xiaojun GU notifications@github.com wrote:

I tried on Ubuntu, not work, following error pop out:

ImportError: numpy.core.multiarray failed to import File "/home/xiaojun/abaqustemp/matplotlib_test.py", line 13, in import matplotlib.pyplot as plt

File "/home/xiaojun/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py", line 24, in import matplotlib.colorbar File "/home/xiaojun/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py", line 27, in import matplotlib.artist as martist File "/home/xiaojun/anaconda/lib/python2.7/site-packages/matplotlib/artist.py", line 8, in from transforms import Bbox, IdentityTransform, TransformedBbox, \ File "/home/xiaojun/anaconda/lib/python2.7/site-packages/matplotlib/transforms.py", line 35, in from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox, — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Solid-Mechanics/matplotlib-4-abaqus/issues/2#issuecomment-270184443, or mute the thread https://github.com/notifications/unsubscribe-auth/AAtgtRmWS98iVK5DBFPFQO-OZOz3GYRAks5rOpH4gaJpZM4F0SOQ.

X-G commented 7 years ago

@youngung , I tried to keep one copy of Numpy, either Anaconda's or Abaqus'. neither of the two solutions work. I think there are something tricky, I will wait you to finish your configuration with your new machine and then use exactly the same version and config. with you.

X-G commented 7 years ago

@youngung , If you put mpl into abaqus successfully, please let me know your approach.

X-G commented 7 years ago

Hi @youngung , Did you managed to install MPL into Abaqus on your new machine?

youngung commented 7 years ago

Sorry I'm still working on it but I could not spend much time yet. I'll let you know.