Author Topic: Error  (Read 642 times)

0 Members and 1 Guest are viewing this topic.

Offline Jahanzaib

  • Heavy QuantumATK user
  • ***
  • Posts: 81
  • Country: gb
  • Reputation: 2
    • View Profile
Error
« on: November 28, 2023, 16:36 »
Hello Expert,
I got error, when I used atkpython. Anyone suggest solution.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 281, in load_module
  File "zipdir/NL/__init__.py", line 363, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 281, in load_module
  File "zipdir/NL/ComputerScienceUtilities/Resources.py", line 14, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 281, in load_module
  File "zipdir/NL/ComputerScienceUtilities/Functions.py", line 4, in <module>
  File "build/lib/python3.8/site-packages/scipy-1.2.1-py3.8-linux-x86_64.egg/scipy/sparse/__init__.py", line 230, in <module>
  File "build/lib/python3.8/site-packages/scipy-1.2.1-py3.8-linux-x86_64.egg/scipy/sparse/base.py", line 10, in <module>
  File "build/lib/python3.8/site-packages/scipy-1.2.1-py3.8-linux-x86_64.egg/scipy/sparse/sputils.py", line 16, in <module>
  File "build/lib/python3.8/site-packages/scipy-1.2.1-py3.8-linux-x86_64.egg/scipy/sparse/sputils.py", line 16, in <listcomp>
  File "/u/jem/wolf6252/.quantumwise/lib/python3.8/site-packages/numpy/__init__.py", line 320, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'typeDict'

Offline filipr

  • QuantumATK Staff
  • Heavy QuantumATK user
  • *****
  • Posts: 73
  • Country: dk
  • Reputation: 6
  • QuantumATK developer
    • View Profile
Re: Error
« Reply #1 on: November 29, 2023, 08:21 »
Can you please share how you ran atkpython and the Python code you tried to execute? Which version of QuantumATK are you using? And did you perhaps by accident install any Python packages into the atkpython distribution?

Offline Jahanzaib

  • Heavy QuantumATK user
  • ***
  • Posts: 81
  • Country: gb
  • Reputation: 2
    • View Profile
Re: Error
« Reply #2 on: November 29, 2023, 22:29 »
Actually, I was trying to install sea born library there, then I got the error, I am using 2021 version of QATK. I just tap atkpython in interactive window. Could you please suggest any solution for this error?

Offline filipr

  • QuantumATK Staff
  • Heavy QuantumATK user
  • *****
  • Posts: 73
  • Country: dk
  • Reputation: 6
  • QuantumATK developer
    • View Profile
Re: Error
« Reply #3 on: November 30, 2023, 11:21 »
Aha, yes. First of all it is a bit dangerous to use pip to install packages into the atkpython distribution, but it is possible as I will show below. But first some background: While Python and Pip makes it appear as you can just install/update/replace packages that is actually not the case: The version and requirements of packages are one thing, but many Python packages use modules written in C/C++/Fortran and those need to be compiled against specific source code version of e.g. numpy/scipy and third party libraries like Intel MKL, OpenMP, MPI and even the C/C++ standard libraries. The only time where one can be truly sure that pip packages work together is if they all are downloaded from PyPi. But many of the PyPi packages don't work with our code and are maybe not using efficient math libraries, which is why other distributions like Conda also exist to try to solve this problem. Now back to your problem at hand: You likely used pip install -U searborn or atkpython -m pip install -U seaborn. With the -U option it will install/upgrade the library and all other libraries/dependencies. This will also replace our shipped version of numpy with the newest from PyPi which will not work with the rest of the code as Numpy is a compiled C/Fortran library with Python wrappers. You now corrupted your installation of QuantumATK and you have to uninstall it and install it again to fix the problem. There are some approaches to install seaborn into your atkpython distribution. If you are using version 2022.12 (I think - you can try it out) or newer it should be possible to use Python virtual environments. If you create a virtual environment and install seaborn into that you don't risk corrupting the QuantumATK installation, so we recommend this approach. You can do:
Code
C:\Program Files\QuantumATK\QuantumATK-VERSION\atkpython\python.exe -m venv --site-packages .
to create a Python venv in the current directory, then activate and use that. You should probably first go though one of the many guides on Python virtual environments: Using the virtual environment Python you should be able to run python -m pip install seaborn. In the virtual environment you won't have access to atkpython and quantumatk executables, but atkpython is basically just normal Python that does an from QuantumATK import * as the first thing. So you can run your atkpython scripts with the venv Python by putting this import statement at the top. If you don't have access to QuantumATK-2022.12 or newer you can install seaborn in your user folder: atkpython -m pip install --user seaborn, then you don't mix atkpython libraries and libraries you installed yourself. Whatever you do the most crucial part is that you do NOT update/upgrade pip packages, i.e. do NOT use the pip install -U option! This will potentially overwrite shipped numpy, scipy and other compiled libraries with default PyPi versions which are incompatible with the rest of the program. If you accidentally do that, you will have to reinstall QuantumATK.