ansys / pymechanical

Pythonic interface to Ansys Mechanical ™
https://mechanical.docs.pyansys.com/
MIT License
36 stars 18 forks source link

__pycache__ creation exception on public read-only installation #455

Closed poinot closed 3 months ago

poinot commented 11 months ago

🔍 Before submitting the issue

🐞 Description of the bug

Using a local installation of pymechanical (0.10.4) python raises an exception on trying to create files into the public __pycache__ directory in the Ansys installation.

Unhandled Exception:
Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.ViewEngines.ViewEngineApplicationStartup ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.ViewEngines.DefaultViewLocator ---> System.UnauthorizedAccessException: Access to the path '/softs/ansys/v2023R2/ansys_inc/v232/fluent/fluent23.2.0/cortex/pylib/workflow/__pycache__' is denied. ---> System.IO.IOException: Permission denied

IMHO:

Actually the installation has not been performed with a compileall call to force creations of *.pyc files, thus my python tries to create them into the public installation without success.

Either to catch the exception or add compileall to installation process of your soft (fluent in that case), to force all *.pyc creations.

📝 Steps to reproduce

$ pip3 install . --user ... Successfully installed ansys-api-platform-instancemanagement-1.0.0 ansys-mechanical-core-0.10.4 ansys-platform-instancemanagement-1.1.2 ansys-pythonnet-3.1.0rc2 ansys-tools-path-0.3.1 ansys_api_mechanical-0.1.1 clr-loader-0.2.6 grpcio-1.59.0 importlib-metadata-6.8.0 $ /softs/ansys/v2023R2/ansys_inc/v232/aisol/.workbench_lite python Python 3.10.8 (main, Oct 18 2022, 15:21:23) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux Type "help", "copyright", "credits" or "license" for more information.

from ansys.mechanical.core import App app = App() print(app) Ansys Mechanical [Ansys Mechanical Enterprise] Product Version:232 Software build date: 05/30/2023 05:40:47

Unhandled Exception: Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.ViewEngines.ViewEngineApplicationStartup ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Nancy.ViewEngines.DefaultViewLocator ---> System.UnauthorizedAccessException: Access to the path '/softs/ansys/v2023R2/ansys_inc/v232/fluent/fluent23.2.0/cortex/pylib/workflow/pycache' is denied. ---> System.IO.IOException: Permission denied

💻 Which operating system are you using?

Linux

📀 Which ANSYS version are you using?

v2023R2

🐍 Which Python version are you using?

3.10

📦 Installed packages

alabaster @ file:///...some-local-directory-path.../env/alabaster-0.7.12.tar.gz
ansys-api-mechanical==0.1.1
ansys-api-platform-instancemanagement==1.0.0
ansys-mechanical-core @ file:///...some-local-directory-path.../ANSYS/pymechanical-0.10.4
ansys-platform-instancemanagement==1.1.2
ansys-pythonnet==3.1.0rc2
ansys-tools-path==0.3.1
anybadge==1.14.0
appdirs==1.4.4
astroid==2.14.1
Babel @ file:///...some-local-directory-path.../env/Babel-2.11.0.tar.gz
bcrypt @ file:///...some-local-directory-path.../env/bcrypt-3.2.2.tar.gz
bidict @ file:///...some-local-directory-path.../env/bidict-0.22.0.tar.gz
certifi @ file:///...some-local-directory-path.../env/certifi-2022.9.24.tar.gz
cffi @ file:///...some-local-directory-path.../env/cffi-1.15.1.tar.gz
charset-normalizer @ file:///...some-local-directory-path.../env/charset-normalizer-2.1.1.tar.gz
click @ file:///...some-local-directory-path.../env/click-8.1.3.tar.gz
clr-loader==0.2.6
colorama @ file:///...some-local-directory-path.../env/colorama-0.4.6.tar.gz
coverage==7.1.0
cppy @ file:///...some-local-directory-path.../env/cppy-1.2.1.tar.gz
cryptography @ file:///...some-local-directory-path.../env/cryptography-2.9.2.tar.gz
cycler @ file:///...some-local-directory-path.../env/cycler-0.11.0.tar.gz
Cython @ file:///...some-local-directory-path.../env/Cython-0.29.32.tar.gz
decorator==4.4.2
dill==0.3.6
docutils @ file:///...some-local-directory-path.../env/docutils-0.19.tar.gz
Flask @ file:///...some-local-directory-path.../env/Flask-2.0.1.tar.gz
Flask-Cors @ file:///...some-local-directory-path.../env/Flask-Cors-3.0.10.tar.gz
Flask-SocketIO @ file:///...some-local-directory-path.../env/Flask-SocketIO-5.0.1.tar.gz
flit_core @ file:///...some-local-directory-path.../env/flit_core-3.7.1.tar.gz
fonttools @ file:///...some-local-directory-path.../env/fonttools-4.38.0.zip
future==0.18.3
grpcio==1.59.0
gssapi==1.6.14
hatchling @ file:///...some-local-directory-path.../env/hatchling-1.11.1.tar.gz
hg-evolve @ file:///...some-local-directory-path.../env/hg-evolve-10.5.2.tar.gz
html-testRunner==1.2.1
idna @ file:///...some-local-directory-path.../env/idna-3.4.tar.gz
igraph @ file:///...some-local-directory-path.../env/igraph-0.10.2.tar.gz
imagesize @ file:///...some-local-directory-path.../env/imagesize-1.4.1.tar.gz
importlib-metadata @ file:///...some-local-directory-path.../env/importlib_metadata-5.0.0.tar.gz
isort==5.12.0
itsdangerous @ file:///...some-local-directory-path.../env/itsdangerous-2.1.2.tar.gz
Jinja2 @ file:///...some-local-directory-path.../env/Jinja2-3.1.2.tar.gz
json2html==1.2.0
kiwisolver @ file:///...some-local-directory-path.../env/kiwisolver-1.4.4.tar.gz
lazy-object-proxy==1.9.0
mando==0.6.4
MarkupSafe @ file:///...some-local-directory-path.../env/MarkupSafe-2.1.1.tar.gz
matplotlib @ file:///...some-local-directory-path.../env/matplotlib-3.5.3.tar.gz
mccabe==0.7.0
mercurial @ file:///...some-local-directory-path.../env/mercurial-6.3.1.tar.gz
numpy==1.23.5
oschmod @ file:///...some-local-directory-path.../env/oschmod-0.3.12.tar.gz
packaging @ file:///...some-local-directory-path.../env/packaging-21.3.tar.gz
paramiko @ file:///...some-local-directory-path.../env/paramiko-2.11.0.tar.gz
pathspec @ file:///...some-local-directory-path.../env/pathspec-0.10.1.tar.gz
Pillow @ file:///...some-local-directory-path.../env/Pillow-9.3.0.tar.gz
platformdirs==3.11.0
pluggy @ file:///...some-local-directory-path.../env/pluggy-1.0.0.tar.gz
protobuf==3.20.3
psutil @ file:///...some-local-directory-path.../env/psutil-5.9.4.tar.gz
pybind11 @ file:///...some-local-directory-path.../env/pybind11-2.10.1.tar.gz
pycparser @ file:///...some-local-directory-path.../env/pycparser-2.21.tar.gz
Pygments @ file:///...some-local-directory-path.../env/Pygments-2.13.0.tar.gz
pylint==2.16.1
pymongo @ file:///...some-local-directory-path.../env/pymongo-4.3.2.tar.gz
PyNaCl @ file:///...some-local-directory-path.../env/PyNaCl-1.5.0.tar.gz
pyparsing @ file:///...some-local-directory-path.../env/pyparsing-3.0.9.tar.gz
python-crontab @ file:///...some-local-directory-path.../env/python-crontab-2.6.0.tar.gz
python-daemon @ file:///...some-local-directory-path.../env/python-daemon-2.3.2.tar.gz
python-dateutil @ file:///...some-local-directory-path.../env/python-dateutil-2.8.2.tar.gz
python-engineio @ file:///...some-local-directory-path.../env/python-engineio-4.1.0.tar.gz
python-socketio @ file:///...some-local-directory-path.../env/python-socketio-5.2.1.tar.gz
pytz @ file:///...some-local-directory-path.../env/pytz-2022.6.tar.gz
PyUnitReport @ file:///...some-local-directory-path.../env/PyUnitReport-master
pyzmq @ file:///...some-local-directory-path.../pyzmq-25.1.1
radon==5.1.0
requests @ file:///...some-local-directory-path.../env/requests-2.28.1.tar.gz
SciPy==1.9.3
semver @ file:///...some-local-directory-path.../env/semver-2.13.0.tar.gz
setproctitle @ file:///...some-local-directory-path.../env/setproctitle-1.3.2.tar.gz
setuptools-scm @ file:///...some-local-directory-path.../env/setuptools_scm-7.0.5.tar.gz
setuptools-scm-git-archive @ file:///...some-local-directory-path.../env/setuptools_scm_git_archive-1.4.tar.gz
six @ file:///...some-local-directory-path.../env/six-1.16.0.tar.gz
snowballstemmer @ file:///...some-local-directory-path.../env/snowballstemmer-2.2.0.tar.gz
Sphinx @ file:///...some-local-directory-path.../env/Sphinx-5.3.0.tar.gz
sphinxcontrib-applehelp @ file:///...some-local-directory-path.../env/sphinxcontrib-applehelp-1.0.2.tar.gz
sphinxcontrib-devhelp @ file:///...some-local-directory-path.../env/sphinxcontrib-devhelp-1.0.2.tar.gz
sphinxcontrib-htmlhelp @ file:///...some-local-directory-path.../env/sphinxcontrib-htmlhelp-2.0.0.tar.gz
sphinxcontrib-jsmath @ file:///...some-local-directory-path.../env/sphinxcontrib-jsmath-1.0.1.tar.gz
sphinxcontrib-qthelp @ file:///...some-local-directory-path.../env/sphinxcontrib-qthelp-1.0.3.tar.gz
sphinxcontrib-serializinghtml @ file:///...some-local-directory-path.../env/sphinxcontrib-serializinghtml-1.1.5.tar.gz
sqametrics==0.0.0
texttable @ file:///...some-local-directory-path.../env/texttable-1.6.4.tar.gz
tomli @ file:///...some-local-directory-path.../env/tomli-2.0.1.tar.gz
tomlkit==0.11.6
tqdm==4.66.1
typing_extensions @ file:///...some-local-directory-path.../env/typing_extensions-4.4.0.tar.gz
urllib3 @ file:///...some-local-directory-path.../env/urllib3-1.26.12.tar.gz
Werkzeug @ file:///...some-local-directory-path.../env/Werkzeug-2.0.1.tar.gz
wrapt==1.14.1
zipp==3.17.0
poinot commented 11 months ago

forgot to mention: install from raw source tar:

pymechanical-0.10.4.tar.gz

koubaa commented 11 months ago

@poinot Something is not fully clear to me here. Does the error come from this line: print(app) if so, why do you show the output of that line (which would only be there if the print did not work)? Or does the output get printed and then you see the error?

And I don't know in what way your code could be accessing ansys_inc/v232/fluent? That seems unrelated to PyMechanical.

poinot commented 11 months ago

I just follow the steps of the tutorial.

I'll have a try without the print and check what's going on...

dipinknair commented 6 months ago

@poinot Are you experience same issues? can you please provide an update?

dipinknair commented 3 months ago

@poinot This issue is being closed due to inactivity. Please reopen if needed.