Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.0: sphinx warnings #7

Closed
kloczek opened this issue Aug 16, 2021 · 12 comments
Closed

2.2.0: sphinx warnings #7

kloczek opened this issue Aug 16, 2021 · 12 comments

Comments

@kloczek
Copy link

kloczek commented Aug 16, 2021

+ /usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx
running build_sphinx
Running Sphinx v4.1.2
making output directory... done
loading intersphinx inventory from https://docs.python.org/3/objects.inv...
myst v0.15.1: MdParserConfig(renderer='sphinx', commonmark_only=False, enable_extensions=['colon_fence', 'smartquotes'], dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', disable_syntax=[], url_schemes=['http', 'https', 'mailto', 'ftp'], heading_anchors=2, heading_slug_func=None, html_meta=[], footnote_transition=True, substitutions=[], sub_delimiters=['{', '}'], words_per_minute=200)
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 7 added, 0 changed, 0 removed
reading sources... [100%] usage
WARNING: autodoc: failed to import class 'Hijri' from module 'convert'; the following exception was raised:
No module named 'hijri_converter'
WARNING: autodoc: failed to import class 'Gregorian' from module 'convert'; the following exception was raised:
No module named 'hijri_converter'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-hijri-converter.3 { background benchmarking usage api changelog contributing } done
build succeeded, 2 warnings.

I'm not 100% sure but looks like line from copy.py

sys.path.insert(0, os.path.abspath("../src/hijri_converter"))

points in wrong location because in src/hijri_converter/ there is no hijri_converter module.

@dralshehri
Copy link
Owner

In addition to installing the dev requirements, you need to install the package in editable mode before running your command:

pip install -e .

Give it a try 🤞🏼

@kloczek
Copy link
Author

kloczek commented Aug 16, 2021

I'm building rpm package from non-root acount.

+ pip install -e .
Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/tkloczko/rpmbuild/BUILD/hijri-converter-2.2.0
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Installing collected packages: hijri-converter
  Running setup.py develop for hijri-converter
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/tkloczko/rpmbuild/BUILD/hijri-converter-2.2.0/setup.py'"'"'; __file__='"'"'/home/tkloczko/rpmbuild/BUILD/hijri-converter-2.2.0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=
         cwd: /home/tkloczko/rpmbuild/BUILD/hijri-converter-2.2.0/
    Complete output (28 lines):
    running develop
    WARNING: The user site-packages directory is disabled.
    error: can't create or remove files in install directory

    The following error occurred while trying to add or remove files in the
    installation directory:

        [Errno 13] Permission denied: '/usr/lib/python3.8/site-packages/test-easy-install-3460223.write-test'

    The installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:

        /usr/lib/python3.8/site-packages/

    Perhaps your account does not have write access to this directory?  If the
    installation directory is a system-owned directory, you may need to sign in
    as the administrator or "root" account.  If you do not have administrative
    access to this machine, you may wish to choose a different installation
    directory, preferably one that is listed in your PYTHONPATH environment
    variable.

    For information on other options, you may wish to consult the
    documentation at:

      https://setuptools.readthedocs.io/en/latest/easy_install.html

    Please make the appropriate changes for your system and try again.

    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/tkloczko/rpmbuild/BUILD/hijri-converter-2.2.0/setup.py'"'"'; __file__='"'"'/home/tkloczko/rpmbuild/BUILD/hijri-converter-2.2.0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix= Check the logs for full command output.

@kloczek
Copy link
Author

kloczek commented Aug 16, 2021

And definitely src/hijri_converter/ path is not path where is possible to find module.

@dralshehri
Copy link
Owner

Can I know more details about the steps you made and produced the original error?

@kloczek
Copy link
Author

kloczek commented Aug 16, 2021

In first line you have command which executes setuptools build_sphinx command which I've grabbed from rpm package build log

/usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx

@dralshehri
Copy link
Owner

I tried that but I need to know more about the building process, including the build tool, commands and operating system, so I can mimic your scenario.

@kloczek
Copy link
Author

kloczek commented Aug 16, 2021

You can try that command before actual build.
Build files are stored in build/lib and in your copy.py file you are not using that location.

I'm using Python 3.8.11, setuptools 57.4.0, and as you see on top of the output I'm using sphinx 4.1.2.

@dralshehri
Copy link
Owner

Have you tried to build the docs within a virtual environment where you can install the package?

@dralshehri
Copy link
Owner

The issue you had was because of sphinx.ext.autodoc extension requires importing the package before generating the api documentation.

I replaced the extension and made some changes.

Until the next release, you can checkout the develop branch and test it out.

@kloczek
Copy link
Author

kloczek commented Aug 17, 2021

If you already made some changes I can wait until next release.

@dralshehri
Copy link
Owner

Fixed on v2.2.1

@kloczek
Copy link
Author

kloczek commented Sep 4, 2021

Just tested. All looks clean now.

Thx :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants