|
.. _faq: |
|
|
|
========================== |
|
Frequently Asked Questions |
|
========================== |
|
|
|
|
|
Python Sphinx Autodoc Is Not Rendering on readthedocs |
|
===================================================== |
|
|
|
The project's dependencies are not specified on RTD, but instead have installed the dependencies locally. We can verify |
|
this in the `build log <https://readthedocs.org/api/v2/build/17857935.txt>`_. Visit the project's Builds, click a build, |
|
and click "view raw":: |
|
|
|
WARNING: autodoc: failed to import module 'rnn' from module 'lamassu'; the following exception was raised: |
|
No module named 'matplotlib' |
|
|
|
To remedy the situation, we must specify that the project's dependencies to be installed. See |
|
`Specifying Dependencies <https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html>`_. |
|
|
|
|
|
Generate Sphinx Documentation Locally |
|
===================================== |
|
|
|
This site is auto-generated using `Sphinx <https://www.sphinx-doc.org/en/master/>`_ with the following command in venv:: |
|
|
|
cd /path/to/lamassu/ |
|
python3 -m venv venv |
|
source venv/bin/activate |
|
pip3 install . |
|
pip3 install -r docs/source/requirements.txt |
|
sphinx-build -a -b html docs/source/ /path/to/html/output/dir |
|
deactivate |
|
|
|
.. NOTE:: |
|
The command above works for Linux/UNIX systems. Some commands will |
|
`differ on Windows OS <https://realpython.com/python-virtual-environments-a-primer/>`_ |
|
|
|
|
|
Install Lamassu from Source Locally |
|
=================================== |
|
|
|
We recommend creating a virtualenv for your application and activate it |
|
|
|
Navigate to the ``lamassu`` root directory and run:: |
|
|
|
pip3 install -e . |
|
|
|
For more general information, please refer to the |
|
`Hitchhiker's Guide to Python <https://docs.python-guide.org/writing/structure/#structuring-your-project>`_: "Structuring Your Project". |
|
|
|
|
|
"module 'collections' has no attribute 'Callable' Error When Running nosetests |
|
============================================================================== |
|
|
|
First, uninstall nose with the following command:: |
|
|
|
pip3 uninstall -y nose |
|
|
|
Second, reinstall nose but with ``--nobinaries`` flag:: |
|
|
|
pip3 install -U nose --no-binary :all: |
|
|
|
Why does this work? At the time of this writing the binary generated by nose was likely generated with a version of |
|
Python 3.4 or older. This command forces to rebuild from source. |
|
|
|
|
|
No module named 'pytest' while Running Test Directly in PyCharm |
|
=============================================================== |
|
|
|
"Right-click" run a ``test_**.py`` file results in:: |
|
|
|
Traceback (most recent call last): |
|
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py", line 5, in <module> |
|
import pytest |
|
ModuleNotFoundError: No module named 'pytest' |
|
|
|
The solution is going to '**Settings** -> **Tools** -> **Python Integrated Tools**' and scroll down to where it says |
|
`pytest not found` and there is a **FIX** button. Clicking on it and apply the settings shall resolve the problem |
|
|