Skip to content

Commit f17a627

Browse files
More emphasis to the warning against the double-import trap (#269)
* More emphasis to the warning against the double-import trap * Minor changes to double import trap warning Co-authored-by: Andres Perez Hortal <16256571+aperezhortal@users.noreply.github.com>
1 parent 2214610 commit f17a627

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

doc/source/user_guide/install_pysteps.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ Finally, to install pysteps and all its dependencies run::
8585
Install from source
8686
-------------------
8787

88-
The recommended way to install pysteps from the source is using `pip`
89-
to adhere to the [PEP517 standards](https://www.python.org/dev/peps/pep-0517/).
90-
Using `pip` instead of `setup.py` guarantees that all the package dependencies
88+
The recommended way to install pysteps from the source is using ``pip``
89+
to adhere to the `PEP517 standards <https://www.python.org/dev/peps/pep-0517/>`_.
90+
Using ``pip`` instead of ``setup.py`` guarantees that all the package dependencies
9191
are properly handled during the installation process.
9292

9393
.. _install_osx_users:
@@ -151,15 +151,19 @@ Or, from a local copy of the repo::
151151
The above commands install the latest version of the **master** branch,
152152
which is continuously under development.
153153

154+
.. warning::
155+
If you are installing pysteps from the sources using pip, the Python interpreter must be launched outside of the pysteps root directory.
156+
Importing pysteps from a working directory that contains the pysteps source code will raise a ``ModuleNotFoundError``.
157+
This error is caused by the root pysteps folder being recognized as the pysteps package, also known as
158+
`the double import trap <http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-double-import-trap>`_.
159+
154160
Setting up the user-defined configuration file
155161
----------------------------------------------
156162

157-
.. _JSON: https://en.wikipedia.org/wiki/JSON
158-
159163
The pysteps package allows the users to customize the default settings
160164
and configuration.
161165
The configuration parameters used by default are loaded from a user-defined
162-
JSON_ file and then stored in the **pysteps.rcparams**, a dictionary-like object
166+
`JSON <https://en.wikipedia.org/wiki/JSON>`_ file and then stored in the **pysteps.rcparams**, a dictionary-like object
163167
that can be accessed as attributes or as items.
164168

165169
.. toctree::
@@ -181,7 +185,3 @@ Launch Python and import pysteps::
181185

182186
python
183187
>>> import pysteps
184-
185-
**Important**: The Python interpreter must be launched outside of the pysteps directory.
186-
Otherwise, it confuses the name of the directory with the package name.
187-
See `Issue 40 <https://github.com/pySTEPS/pysteps/issues/40>`_.

0 commit comments

Comments
 (0)