Skip to content

PyFluent on Linux: Unable to install via pip. #197

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

Closed
ypatel-qa opened this issue Mar 18, 2022 · 13 comments
Closed

PyFluent on Linux: Unable to install via pip. #197

ypatel-qa opened this issue Mar 18, 2022 · 13 comments
Assignees

Comments

@ypatel-qa
Copy link
Contributor

ypatel-qa commented Mar 18, 2022

    • Linux machine name: lebfluintrh08 (RH8.5)
    • /usr/bin/pip3
    • pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

While installing PyFluent via pip3 on Linux, I am getting this error:

[ypatel@lebfluintrh08][/net/nfs.lebisilon/home/ypatel/pyfluent/pyfluent]> pip3 install -e .
Obtaining file:///net/nfs.lebisilon/home/ypatel/pyfluent/pyfluent
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/net/nfs.lebisilon/home/ypatel/pyfluent/pyfluent/setup.py", line 4, in <module>
        from setuptools import find_namespace_packages, setup
    ImportError: cannot import name 'find_namespace_packages'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /net/nfs.lebisilon/home/ypatel/pyfluent/pyfluent/
[ypatel@lebfluintrh08][/net/nfs.lebisilon/home/ypatel/pyfluent/pyfluent]> pip3 install pyfluent
Collecting pyfluent
  Using cached https://files.pythonhosted.org/packages/06/4b/96f9ac3237ed70648da3194c8da59c514c4a325031f32948b9b1a99b950a/pyfluent-0.2.1.tar.gz
Collecting msgpack-python>=0.3.0 (from pyfluent)
  Using cached https://files.pythonhosted.org/packages/8a/20/6eca772d1a5830336f84aca1d8198e5a3f4715cd1c7fc36d3cc7f7185091/msgpack-python-0.5.6.tar.gz
Installing collected packages: msgpack-python, pyfluent
  Running setup.py install for msgpack-python ... error
    Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ml6yrf4n/msgpack-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-h_hfoypv-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/msgpack
    copying msgpack/_version.py -> build/lib.linux-x86_64-3.6/msgpack
    copying msgpack/__init__.py -> build/lib.linux-x86_64-3.6/msgpack
    copying msgpack/exceptions.py -> build/lib.linux-x86_64-3.6/msgpack
    copying msgpack/fallback.py -> build/lib.linux-x86_64-3.6/msgpack
    running build_ext
    building 'msgpack._packer' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/msgpack
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -D__LITTLE_ENDIAN__=1 -I. -I/usr/include/python3.6m -c msgpack/_packer.cpp -o build/temp.linux-x86_64-3.6/msgpack/_packer.o
    msgpack/_packer.cpp:4:10: fatal error: Python.h: No such file or directory
     #include "Python.h"
              ^~~~~~~~~~
    compilation terminated.
    WARNING: Failed to compile extension modules.
    msgpack uses fallback pure python implementation.
    command 'gcc' failed with exit status 1
    building 'msgpack._unpacker' extension
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -D__LITTLE_ENDIAN__=1 -I. -I/usr/include/python3.6m -c msgpack/_unpacker.cpp -o build/temp.linux-x86_64-3.6/msgpack/_unpacker.o
    msgpack/_unpacker.cpp:4:10: fatal error: Python.h: No such file or directory
     #include "Python.h"
              ^~~~~~~~~~
    compilation terminated.
    WARNING: Failed to compile extension modules.
    msgpack uses fallback pure python implementation.
    command 'gcc' failed with exit status 1
    running install_lib
    creating /usr/local/lib64/python3.6
    error: could not create '/usr/local/lib64/python3.6': Permission denied

    ----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ml6yrf4n/msgpack-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-h_hfoypv-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ml6yrf4n/msgpack-python/
[ypatel@lebfluintrh08][/net/nfs.lebisilon/home/ypatel/pyfluent/pyfluent]>
@ypatel-qa
Copy link
Contributor Author

@seanpearsonuk - I am not sure if I should try with "sudo" access or ask IT to install it? Do we expect our Linux users to have "sudo" access?

@seanpearsonuk
Copy link
Collaborator

Is this a regression or the first time you've tried? Presumably some folks have been doing this on Linux already.

@seanpearsonuk
Copy link
Collaborator

please run pip list and report the version of setuptools in particular

@seanpearsonuk
Copy link
Collaborator

also I believe we require Python version >3.6 as indicated in setup.py

@seanpearsonuk
Copy link
Collaborator

find_namespace_packages was introduced in v40.1.0 of setuptools

@dnwillia-work
Copy link
Collaborator

dnwillia-work commented Mar 18, 2022

Try it again with a virtual environment and install new setuptools? eg: if your shell is a bash, it's like this I think:

python -m venv venv
. venv/bin/activate
pip install setuptools

That should get around needing sudo. Though, Sean is right, we don't support anything older than 3.7:
https://dev.docs.pyansys.com/guidelines/version_support.html

maybe we can make a check for this in setup.py

@ypatel-qa
Copy link
Contributor Author

@seanpearsonuk @dnwillia-work Thank you.

IT has upgraded the Python version on lebfluintrh08.

[ypatel@lebfluintrh08][/net/nfs.lebisilon/home/ypatel]> pip3 list
Package Version


pip 19.3.1
setuptools 41.6.0
[ypatel@lebfluintrh08][/net/nfs.lebisilon/home/ypatel]> python --version
Python 3.8.8
[ypatel@lebfluintrh08][/net/nfs.lebisilon/home/ypatel]>

However, I still get this error,

[ypatel@lebfluintrh08][/net/nfs.lebisilon/home/ypatel/pyfluent/pyfluent]> pip3 install -e .
Obtaining file:///net/nfs.lebisilon/home/ypatel/pyfluent/pyfluent
Collecting grpcio>=1.30.0
Using cached https://files.pythonhosted.org/packages/5b/92/a00eed89bae16e48644f514c842b1cc6deaf0f79cb7dcfeda2dc514e11af/grpcio-1.44.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Collecting numpy>=1.21.5
Using cached https://files.pythonhosted.org/packages/38/c0/c45c5eb0e25247d5fbb333fd0b56e570ba21cf0e3dca3abad174fb780e8c/numpy-1.22.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Collecting protobuf>=3.12.2
Using cached https://files.pythonhosted.org/packages/d5/c8/64de54ef0121a1ff6309f102124c6b5a89260dc584e1871341f5199b7b85/protobuf-3.19.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Collecting six>=1.5.2
Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Installing collected packages: six, grpcio, numpy, protobuf, ansys-fluent-solver
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.8'
Consider using the --user option or check the permissions.

[ypatel@lebfluintrh08][/net/nfs.lebisilon/home/ypatel/pyfluent/pyfluent]>

@ypatel-qa
Copy link
Contributor Author

@seanpearsonuk @dnwillia-work Use of virtual environment seems working fine to launch PyFluent (without sudo access). Let me follow up on testing using vnev.

@dnwillia-work
Copy link
Collaborator

@ypatel-qa Is there anything left to do on this?

@ypatel-qa
Copy link
Contributor Author

Hi @dnwillia-work venv is working fine on Linux without sudo access. This issue can be closed.

Just wondering if we need to document this information for users?

@dnwillia-work
Copy link
Collaborator

Yeah right. Let’s at least see if there is a way to check for the interpreter version.

@jorgepiloto
Copy link
Member

Glad to see @dnwillia-work and @seanpearsonuk provided guidance on how to solve this. Just a couple of comments before closing this, @ypatel-qa:

  • Avoid executing sudo python ... or sudo pip .... The output of this commands might break your default Python installation, the one being used by the system usually.

  • Use which python to check for the Python interpreter you are running. Make sure it does not point to /usr/bin/python, as this is the system's one.

This issue is related with ansys/pyansys-dev-guide#50.

@ypatel-qa
Copy link
Contributor Author

Thank you @jorgepiloto .

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

4 participants