Sphinx Documentation (autodoc) not working after uploading to Github - python-sphinx

I have built sphinx documentation for my package.
It is working fine when testing localhost. But after uploading it to Github and building docs on readthedocs.org the documentation page is not working which uses autodoc.
Here is the link to the Github repository.
https://github.com/SparkDrago05/quick_sqlite
Here is the link to the documentation.
https://quick-sqlite.readthedocs.io/en/latest/index.html
Any help will be appreciated!

In your log file, it states WARNING: autodoc: failed to import class 'QuickSqlite' from module 'quick_sqlite'; the following exception was raised: No module named 'quick_sqlite'
You need to tell RTD to install your module. See: https://docs.readthedocs.io/en/stable/tutorial/index.html#making-warnings-more-visible
The reason sphinx.ext.autosummary and sphinx.ext.autodoc fail to import the code is because it is not installed. Luckily, the .readthedocs.yaml also allows you to specify which requirements to install.
.readthedocs.yaml
python:
# Install our python package before building the docs
install:
- method: pip
path: .

Related

How to install YAML package in Pycharm (Python 3.8 / 3.9)?

How do I install the YAML package in Pycharm? I want to use it for a python 3.8 (or 3.9) project. When trying to install the package via the project settings I get the following error:
ERROR: Could not find a version that satisfies the requirement yaml
Alternatively I tried to search for any YAML package available via the command window by typing pip search yaml. Then I get the following error:
ERROR: XMLRPC request failed [code: -32500]
Any advice?
Thanks
pip install pyyaml
I think that this is what you are looking for: https://pypi.org/project/PyYAML/
It gets imported as import yaml

Azure functions (cloud): Install cython dependent module

I'm trying to install/import a cython dependent module [ZigZag] into my python function on Azure functions (Linux platfrom), I'm working via Windows 8.1 (VSCode), Running Python 3.6 on both local machine and azure functions.
I tried including Cython in the requirements.txt file, this errors out during deployment (seems installation of external modules happens somewhat in parallel)
I tried creating a '.toml' file, no luck.
I also tried the idea found here Python google cloud function deployment failure - Madmom pip package still didn't work.
Finally I decided to deploy the function first (with cython included in the 'requirements.txt' file) without the zigzag module, and then in my python script use subprocess.Popen() to do a pip install zigzag and import it before the rest of the function runs.
This is where I get stuck. In my python file I have these lines included to do the above:
#function to be called in azure __init__.py file
def f....:
# check for zigzag
try:
import zigzag
except ImportError:
subprocess.Popen(["pip", "install", "ZigZag"], shell=True)
finally:
import zigzag
.
.
.
rest of the function...
This deploys successfully to azure functions, however it fails during execution with the error:
Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException :
Result: Failure Exception: ModuleNotFoundError: No module named 'zigzag
Any idea's how to do this correctly?
NB: This issue occurs on google cloud functions as well.
I see this is related to https://learn.microsoft.com/en-us/answers/questions/152557/index.html
As per the thread, the latest version for ZigZag is 0.2.2 and the supported python version is 3.5: https://pypi.org/project/ZigZag/
The azure function supports 3.6 and above python version which will make it incompatible. You can try installing the latest cython using requirements.txt and it will work as expected. But when you try to install ZigZaG it tries to find the dependency of cython package (Cython==0.26.1) that is compatible with it therefor it throws the error that cython package not found.

How to fix library dependence in a conan package

I am trying to install qt/5.14.2 with conan.
Using
qt/5.14.2#bincrafters/stable
I receive
ERROR: libpq/11.5: Error in package_info() method, line 211
self.cpp_info.components["pq"].requires.append("zlib::zlib")
AttributeError: 'Component' object has no attribute 'requires'
OK, there is a bug in libpq/11.5
I am trying to downgrade to
libpq/11.4#bincrafters/stable
ERROR: Conflict in qt/5.14.2#bincrafters/stable:
'qt/5.14.2#bincrafters/stable' requires 'zlib/1.2.11' while 'libpq/11.4#bincrafters/stable' requires 'zlib/1.2.11#conan/stable'.
To fix this conflict you need to override the package 'zlib' in your root package.
BTW:
Why is it not enough to require the correct version of the library, and requiring the same repository? (and require two different repositories in two different packages for the same dependence)
OK, I attempted
zlib/1.2.11#bincrafters/stable
WARN: libpq/11.4#bincrafters/stable: requirement zlib/1.2.11#conan/stable overridden by your conanfile to zlib/1.2.11#bincrafters/stable
zlib/1.2.11#bincrafters/stable: Not found in local cache, looking in remotes...
zlib/1.2.11#bincrafters/stable: Trying with 'conan-center'...
zlib/1.2.11#bincrafters/stable: Trying with 'minres'...
zlib/1.2.11#bincrafters/stable: Trying with 'bincrafters'...
ERROR: Failed requirement 'zlib/1.2.11#bincrafters/stable' from 'libpq/11.4#bincrafters/stable'
ERROR: Unable to find 'zlib/1.2.11#bincrafters/stable' in remotes
Finally, I arrived at
libpq/11.4#bincrafters/stable
zlib/1.2.11#conan/stable
qt/5.14.2#bincrafters/stable
After this, it looks like it was oK:
Installing (downloading, building) binaries...
qt/5.14.2#bincrafters/stable: Retrieving package 93c70de10405da9f2d5a1f42b8c299ca7af869d2 from remote 'bincrafters'
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
....qt/5.14.2#bincrafters/stable: Package installed 93c70de10405da9f2d5a1f42b8c299ca7af869d2
qt/5.14.2#bincrafters/stable: Downloaded package revision 0
However, the install fails with
CMake was unable to find Qt5, put qmake in your path or set
QTDIR/QT_QMAKE_EXECUTABLE.
The package is downloaded, I see all components in the corresponding subdirectory in my home directory. However, unlike the other components, it is not installed, before CMake attempts to find it.
What do I wrong?
In case of any strange behavior of conan, upgrade! For me, switch 1.24.0 -> 1.28.1 with configs clean up fixed the same problem with libpq/11.5

Installing python Github package error: package directory 'src' does not exist

I am new at installing external Github packages into python.
I successfully cloned a package by running the command
git clone https://github.com/vishnubob/python-midi.git
However, when I ran
python setup.py install
I received the error:
No sequencer available for 'win32' platform.
C:\Python27\lib\site-packages\setuptools\dist.py:341: UserWarning:
Normalizing 'v0.2.3' to '0.2.3'
normalized_version,
running install
running bdist_egg
running egg_info
creating midi.egg-info
writing midi.egg-info\PKG-INFO
writing top-level names to midi.egg-info\top_level.txt
writing dependency_links to midi.egg-info\dependency_links.txt
writing manifest file 'midi.egg-info\SOURCES.txt'
**error: package directory 'src' does not exist**
Is this a directory problem? And is there another approach to install this package (possible via pip)?
The readme on git hub has: "I am extremely interested in supporting OS-X and Win32 sequencers as well, but I need platform expert who can help me. Are you that person? Please contact me if you would like to help."
So it is simply not supported on Win32.

read-the-docs: ImportError despite dependency being set in setup.py

Consider this build error:
I see lines like: ImportError: No module named swisseph and invalid signature for automodule (u'jyotisha\n :members:'). My setup.py does include pyswisseph as a dependency already.. What's a good fix?
PS: My local sphinx build seems fine.
Following #steve-piercy's tip and the FAQ, I was able to get past this error - I just needed to to enable the virtualenv feature in the Admin page of my project.
The install then fails for another (as yet undebugged reason) - but that's separate.

Resources