5
$\begingroup$

I installed the module LAMMPS by using this command

conda install -c conda-forge lammps

I want to import LAMMPS to python code, but it says:

>>> import lammps
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'lammps'

Anyone can tell me how to import lammps to python.

$\endgroup$
9
  • 1
    $\begingroup$ What is your default Python path? When you open the interpreter, what version of Python and source is listed? $\endgroup$
    – Tyberius
    Mar 4 at 15:29
  • $\begingroup$ The python path is in the anaconda /Users/luonghuuduc/anaconda3/. After opening the interpreter, it say: Python 3.7.3 (default, Mar 27 2019, 16:54:48) [Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information. $\endgroup$
    – Binh Thien
    Mar 4 at 15:40
  • 2
    $\begingroup$ Is conda active, i.e. have you run 'conda activate'? If yes, your shell should show the conda environment, e.g. '(base) bash-4.2$'. $\endgroup$
    – Fabian
    Mar 4 at 16:22
  • 2
    $\begingroup$ You have to reinstall all packages in the lammps environment. Run "conda activate lammps" and then "pip install numpy" $\endgroup$
    – Fabian
    Mar 5 at 8:14
  • 4
    $\begingroup$ @BinhThien You also need to have numpy installed in this new environment (e.g. using conda install -c conda-forge numpy), is it the case ? $\endgroup$
    – Hebo
    Mar 5 at 8:17