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

An issue about "module 'spopt' has no attribute 'version'" #79

Closed
xf37 opened this issue Dec 7, 2020 · 8 comments
Closed

An issue about "module 'spopt' has no attribute 'version'" #79

xf37 opened this issue Dec 7, 2020 · 8 comments
Assignees
Labels
docs question Further information is requested

Comments

@xf37
Copy link
Collaborator

xf37 commented Dec 7, 2020

When I ran sphinx-build -b html docsrc docs to build docs website, I got

Running Sphinx v3.1.2
Configuration error:
There is a programmable error in your configuration file:
Traceback (most recent call last):
File "/Users/anaconda3/lib/python3.8/site-packages/sphinx/config.py", line 319, in eval_configfile
execfile(filename, namespace)
File "/Users/anaconda3/lib/python3.8/site-packages/sphinx/util/pycompat.py", line 88, in execfile_
exec(code, _globals)
File "/Users/xinfeng/spopt_rst/docsrc/conf.py", line 60, in <module>
version = spopt.version
AttributeError: module 'spopt' has no attribute 'version'

However, the first line of the init.py under the folder spopt is:
__version__ = "0.1.0"

I have tried to type import spopt and spopt.__version__ in python, and get the right answer. NOT sure why conf.py cannot obtain the version info via import spopt.

@jGaboardi
Copy link
Member

When I ran sphinx-build -b html docsrc docs

Try running make html from within the ./docsrc directory then make sync if that succeeds.

@jGaboardi jGaboardi added docs question Further information is requested labels Dec 7, 2020
@xf37
Copy link
Collaborator Author

xf37 commented Dec 7, 2020

When I ran sphinx-build -b html docsrc docs

Try running make html from within the ./docsrc directory then make sync if that succeeds.

I tried while met the same error.

@jGaboardi
Copy link
Member

OK, I will try to take a look at this soon.

@jGaboardi
Copy link
Member

@xf37 Which version of spenc are you using? When I run make html I am getting the following?

Running Sphinx v3.3.1
/Users/the-gaboardi/miniconda3/envs/py3_spopt/lib/python3.8/site-packages/sklearn/utils/deprecation.py:143: FutureWarning: The sklearn.cluster.spectral module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.cluster. Anything that cannot be imported from sklearn.cluster is now part of the private API.
  warnings.warn(message, FutureWarning)

Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/Users/the-gaboardi/miniconda3/envs/py3_spopt/lib/python3.8/site-packages/sphinx/config.py", line 319, in eval_config_file
    execfile_(filename, namespace)
  File "/Users/the-gaboardi/miniconda3/envs/py3_spopt/lib/python3.8/site-packages/sphinx/util/pycompat.py", line 89, in execfile_
    exec(code, _globals)
  File "/Users/the-gaboardi/spopt/docsrc/conf.py", line 13, in <module>
    import spopt
  File "/Users/the-gaboardi/spopt/spopt/__init__.py", line 6, in <module>
    from .region import MaxPHeuristic
  File "/Users/the-gaboardi/spopt/spopt/region/__init__.py", line 6, in <module>
    from .spenc import Spenc
  File "/Users/the-gaboardi/spopt/spopt/region/spenc.py", line 4, in <module>
    from spenc import SPENC
  File "/Users/the-gaboardi/miniconda3/envs/py3_spopt/lib/python3.8/site-packages/spenc/__init__.py", line 1, in <module>
    from .abstracts import SPENC
  File "/Users/the-gaboardi/miniconda3/envs/py3_spopt/lib/python3.8/site-packages/spenc/abstracts.py", line 17, in <module>
    class SPENC(clust.SpectralClustering):
  File "/Users/the-gaboardi/miniconda3/envs/py3_spopt/lib/python3.8/site-packages/spenc/abstracts.py", line 457, in SPENC
    attribute_score=skm.calinski_harabaz_score,
AttributeError: module 'sklearn.metrics' has no attribute 'calinski_harabaz_score'

make: *** [html] Error 2

Even importing spenc is not possible:

Python 3.8.5 | packaged by conda-forge | (default, Aug 29 2020, 01:18:42) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.18.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import spenc
/Users/the-gaboardi/miniconda3/envs/py3_spopt/lib/python3.8/site-packages/sklearn/utils/deprecation.py:143: FutureWarning: The sklearn.cluster.spectral module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.cluster. Anything that cannot be imported from sklearn.cluster is now part of the private API.
  warnings.warn(message, FutureWarning)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-b10ad84211d1> in <module>
----> 1 import spenc

~/miniconda3/envs/py3_spopt/lib/python3.8/site-packages/spenc/__init__.py in <module>
----> 1 from .abstracts import SPENC

~/miniconda3/envs/py3_spopt/lib/python3.8/site-packages/spenc/abstracts.py in <module>
     15 from warnings import warn as Warn
     16 
---> 17 class SPENC(clust.SpectralClustering):
     18     def __init__(self, n_clusters=8, eigen_solver=None, random_state=None,
     19                  n_init=10, gamma=1., affinity='rbf', n_neighbors=10,

~/miniconda3/envs/py3_spopt/lib/python3.8/site-packages/spenc/abstracts.py in SPENC()
    455 
    456     def score(self, X, W, labels=None, delta=.5, 
--> 457               attribute_score=skm.calinski_harabaz_score,
    458               spatial_score=boundary_fraction,
    459               attribute_kw = dict(),

AttributeError: module 'sklearn.metrics' has no attribute 'calinski_harabaz_score'

@jGaboardi
Copy link
Member

Click for full environment details:
(py3_spopt) jGaboardi:docsrc the-gaboardi$ conda list
# packages in environment at /Users/the-gaboardi/miniconda3/envs/py3_spopt:
#
# Name                    Version                   Build  Channel
alabaster                 0.7.12                     py_0    conda-forge
amply                     0.1.2              pyh9f0ad1d_0    conda-forge
appdirs                   1.4.3                      py_1    conda-forge
appnope                   0.1.0           py38h32f6830_1001    conda-forge
attrs                     20.2.0             pyh9f0ad1d_0    conda-forge
babel                     2.9.0              pyhd3deb0d_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.1                      py_0    conda-forge
beautifulsoup4            4.9.1                      py_1    conda-forge
black                     19.10b0                    py_4    conda-forge
boost-cpp                 1.74.0               he5d75e3_0    conda-forge
brotlipy                  0.7.0           py38h64e0658_1000    conda-forge
bs4                       4.9.1                         1    conda-forge
bzip2                     1.0.8                haf1e3a3_3    conda-forge
c-ares                    1.16.1               haf1e3a3_3    conda-forge
ca-certificates           2020.12.5            h033912b_0    conda-forge
cairo                     1.16.0            ha8983da_1005    conda-forge
certifi                   2020.12.5        py38h50d1736_0    conda-forge
cffi                      1.14.1           py38hc4dd44e_0    conda-forge
cfgv                      3.2.0                      py_0    conda-forge
cfitsio                   3.470                hdf94aef_6    conda-forge
chardet                   3.0.4           py38h32f6830_1006    conda-forge
click                     7.1.2              pyh9f0ad1d_0    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
cligj                     0.5.0                      py_0    conda-forge
coincbc                   2.10.5               h186aa8c_0    conda-forge
conda                     4.8.5            py38h32f6830_1    conda-forge
conda-package-handling    1.7.0            py38h4d0b108_4    conda-forge
coverage                  5.2.1            py38h4d0b108_0    conda-forge
cryptography              3.1              py38h52adbb4_0    conda-forge
curl                      7.71.1               hcb81553_5    conda-forge
cycler                    0.10.0                     py_2    conda-forge
decorator                 4.4.2                      py_0    conda-forge
distlib                   0.3.1              pyh9f0ad1d_0    conda-forge
docutils                  0.16             py38h32f6830_1    conda-forge
editdistance              0.5.3            py38h11c0d25_1    conda-forge
expat                     2.2.9                hb1e8313_2    conda-forge
filelock                  3.0.12             pyh9f0ad1d_0    conda-forge
fiona                     1.8.17           py38hcfd527e_0    conda-forge
fontconfig                2.13.1            h79c0d67_1002    conda-forge
freetype                  2.10.2               h8da9a1a_0    conda-forge
freexl                    1.0.5             h0b31af3_1002    conda-forge
gdal                      3.1.2            py38hbe58a21_1    conda-forge
geopandas                 0.8.1                      py_0    conda-forge
geos                      3.8.1                h4a8c4bd_0    conda-forge
geotiff                   1.6.0                h4e9c399_1    conda-forge
gettext                   0.19.8.1          h46ab8bc_1002    conda-forge
giflib                    5.2.1                h0b31af3_2    conda-forge
glib                      2.66.0               hdb5fb44_0    conda-forge
hdf4                      4.2.13            h84186c3_1003    conda-forge
hdf5                      1.10.6          nompi_haae91d6_101    conda-forge
icu                       67.1                 hb1e8313_0    conda-forge
identify                  1.5.2              pyh9f0ad1d_0    conda-forge
idna                      2.10               pyh9f0ad1d_0    conda-forge
imagesize                 1.2.0                      py_0    conda-forge
iniconfig                 1.0.1              pyh9f0ad1d_0    conda-forge
ipython                   7.18.1           py38h1cdfbd6_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
jedi                      0.17.2           py38h32f6830_0    conda-forge
jinja2                    2.11.2             pyh9f0ad1d_0    conda-forge
joblib                    0.16.0                     py_0    conda-forge
jpeg                      9d                   h0b31af3_0    conda-forge
json-c                    0.13.1            h575e443_1002    conda-forge
kealib                    1.4.13               h40102fb_1    conda-forge
kiwisolver                1.2.0            py38ha0d09dd_0    conda-forge
krb5                      1.17.1               h75d18d8_3    conda-forge
latexcodec                2.0.1              pyh9f0ad1d_0    conda-forge
lcms2                     2.11                 h174193d_0    conda-forge
libblas                   3.8.0               17_openblas    conda-forge
libcblas                  3.8.0               17_openblas    conda-forge
libcurl                   7.71.1               h9bf37e3_5    conda-forge
libcxx                    10.0.1               h5f48129_0    conda-forge
libdap4                   3.20.6               h993cace_1    conda-forge
libedit                   3.1.20191231         h0678c8f_2    conda-forge
libev                     4.33                 haf1e3a3_1    conda-forge
libffi                    3.2.1             hb1e8313_1007    conda-forge
libgdal                   3.1.2                h6dfbaa8_1    conda-forge
libgfortran               4.0.0                         3    conda-forge
libgfortran4              7.5.0                h1565451_3    conda-forge
libiconv                  1.16                 haf1e3a3_0    conda-forge
libkml                    1.3.0             h8ca2c65_1012    conda-forge
liblapack                 3.8.0               17_openblas    conda-forge
libnetcdf                 4.7.4           nompi_hc5b2cf3_105    conda-forge
libnghttp2                1.41.0               h7580e61_2    conda-forge
libopenblas               0.3.10          openmp_h63d9170_4    conda-forge
libpng                    1.6.37               hb0a8c7a_2    conda-forge
libpq                     12.3                 h489d428_0    conda-forge
libpysal                  4.3.0                      py_0    conda-forge
libspatialindex           1.9.3                h4a8c4bd_3    conda-forge
libspatialite             4.3.0a            h231dce8_1039    conda-forge
libssh2                   1.9.0                h8a08a2b_5    conda-forge
libtiff                   4.1.0                h2ae36a8_6    conda-forge
libwebp-base              1.1.0                h0b31af3_3    conda-forge
libxml2                   2.9.10               h2c6e4a5_2    conda-forge
llvm-openmp               10.0.1               h28b9765_0    conda-forge
lz4-c                     1.9.2                hb1e8313_3    conda-forge
markupsafe                1.1.1            py38h64e0658_1    conda-forge
matplotlib                3.3.1                         1    conda-forge
matplotlib-base           3.3.1            py38haed9462_1    conda-forge
mip                       1.12.0                   pypi_0    pypi
more-itertools            8.5.0                      py_0    conda-forge
munch                     2.5.0                      py_0    conda-forge
ncurses                   6.2                  hb1e8313_1    conda-forge
networkx                  2.5                        py_0    conda-forge
nodeenv                   1.5.0              pyh9f0ad1d_0    conda-forge
numpy                     1.19.1           py38h8ccc501_2    conda-forge
numpydoc                  1.1.0                      py_1    conda-forge
olefile                   0.46                       py_0    conda-forge
openjpeg                  2.3.1                h254dc36_3    conda-forge
openssl                   1.1.1h               haf1e3a3_0    conda-forge
ortools                   7.8.7959                 pypi_0    pypi
oset                      0.1.3                      py_1    conda-forge
packaging                 20.4               pyh9f0ad1d_0    conda-forge
pandas                    1.1.1            py38h11c0d25_0    conda-forge
parso                     0.7.1              pyh9f0ad1d_0    conda-forge
pathspec                  0.8.0              pyh9f0ad1d_0    conda-forge
pcre                      8.44                 h4a8c4bd_0    conda-forge
pexpect                   4.8.0            py38h32f6830_1    conda-forge
pickleshare               0.7.5           py38h32f6830_1001    conda-forge
pillow                    7.2.0            py38h83dc5e5_1    conda-forge
pip                       20.2.2                     py_0    conda-forge
pixman                    0.38.0            h01d97ff_1003    conda-forge
pluggy                    0.13.1           py38h32f6830_2    conda-forge
poppler                   0.89.0               h3232a60_1    conda-forge
poppler-data              0.4.9                         1    conda-forge
postgresql                12.3                 h62ab893_0    conda-forge
pre-commit                2.7.1            py38h32f6830_0    conda-forge
proj                      7.1.0                h45baca5_1    conda-forge
prompt-toolkit            3.0.7                      py_0    conda-forge
protobuf                  3.13.0                   pypi_0    pypi
ptyprocess                0.6.0                   py_1001    conda-forge
pulp                      2.3              py38h32f6830_1    conda-forge
py                        1.9.0              pyh9f0ad1d_0    conda-forge
pybtex                    0.23.0           py38h32f6830_0    conda-forge
pybtex-docutils           0.2.2            py38h32f6830_2    conda-forge
pycosat                   0.6.3           py38h64e0658_1004    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pygments                  2.7.0                      py_0    conda-forge
pyopenssl                 19.1.0                     py_1    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyproj                    2.6.1.post1      py38hf032eb0_1    conda-forge
pysocks                   1.7.1            py38h32f6830_1    conda-forge
pytest                    6.0.1            py38h32f6830_0    conda-forge
pytest-cov                2.10.1             pyh9f0ad1d_0    conda-forge
python                    3.8.5           hfc71d35_7_cpython    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
python_abi                3.8                      1_cp38    conda-forge
pytz                      2020.1             pyh9f0ad1d_0    conda-forge
pyyaml                    5.3.1            py38h64e0658_0    conda-forge
readline                  8.0                  h0678c8f_2    conda-forge
regex                     2020.7.14        py38h4d0b108_0    conda-forge
requests                  2.24.0             pyh9f0ad1d_0    conda-forge
rtree                     0.9.4            py38h08f867b_1    conda-forge
ruamel_yaml               0.15.80         py38h4d0b108_1002    conda-forge
scikit-learn              0.23.2           py38hfde8033_0    conda-forge
scipy                     1.5.2            py38h1402333_0    conda-forge
setuptools                49.6.0           py38h32f6830_0    conda-forge
shapely                   1.7.1            py38h8918236_0    conda-forge
six                       1.15.0             pyh9f0ad1d_0    conda-forge
snowballstemmer           2.0.0                      py_0    conda-forge
soupsieve                 2.0.1                      py_1    conda-forge
spenc                     0.2                        py_0    conda-forge
sphinx                    3.3.1              pyhd8ed1ab_0    conda-forge
sphinx_bootstrap_theme    0.8.0                      py_0    conda-forge
sphinxcontrib-applehelp   1.0.2                      py_0    conda-forge
sphinxcontrib-bibtex      1.0.0                      py_0    conda-forge
sphinxcontrib-devhelp     1.0.2                      py_0    conda-forge
sphinxcontrib-htmlhelp    1.0.3                      py_0    conda-forge
sphinxcontrib-jsmath      1.0.1                      py_0    conda-forge
sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
sphinxcontrib-serializinghtml 1.1.4                      py_0    conda-forge
spopt                     0.1.0                     dev_0    <develop>
sqlite                    3.33.0               h960bd1c_0    conda-forge
tbb                       2019.9               ha1b3eb9_1    conda-forge
threadpoolctl             2.1.0              pyh5ca1d4c_0    conda-forge
tiledb                    2.0.8                h8973ade_0    conda-forge
tk                        8.6.10               hb0a8c7a_0    conda-forge
toml                      0.10.1             pyh9f0ad1d_0    conda-forge
tornado                   6.0.4            py38h64e0658_1    conda-forge
tqdm                      4.49.0             pyh9f0ad1d_0    conda-forge
traitlets                 5.0.4                      py_0    conda-forge
typed-ast                 1.4.1            py38h0b31af3_0    conda-forge
tzcode                    2020a                h0b31af3_0    conda-forge
urllib3                   1.25.10                    py_0    conda-forge
virtualenv                20.0.20          py38h32f6830_1    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_1    conda-forge
wheel                     0.35.1             pyh9f0ad1d_0    conda-forge
xerces-c                  3.2.3                h0a0444a_1    conda-forge
xz                        5.2.5                haf1e3a3_1    conda-forge
yaml                      0.2.5                haf1e3a3_0    conda-forge
zlib                      1.2.11            h7795811_1009    conda-forge
zstd                      1.4.5                h289c70a_2    conda-forge

@jGaboardi jGaboardi added this to In progress in Release v0.1.0 Dec 8, 2020
@jGaboardi
Copy link
Member

Related to #81/#54.

@ljwolf
Copy link
Member

ljwolf commented Dec 8, 2020

Yes, sorry, the local development copy underwriting the paper has modified this. calinski_harabaz_score was changed to calinski_harabasz_score. Happy to cut another release to address this, but I won't have time at least til next week.

@xf37
Copy link
Collaborator Author

xf37 commented Dec 9, 2020

It is solved by update sys.path.insert(0, os.path.abspath("../")) in conf.py

@xf37 xf37 closed this as completed Dec 9, 2020
@jGaboardi jGaboardi moved this from In progress to Done in Release v0.1.0 Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs question Further information is requested
Projects
No open projects
Development

No branches or pull requests

4 participants