cdelker / schemdraw

MIT License
103 stars 20 forks source link

0.18 conda-forge Package Broken #36

Closed ibrummel closed 4 months ago

ibrummel commented 4 months ago

In the 0.18 version of schemdraw that is available from conda-forge, instantiation of elements is broken. Instantiating any element subclasssed from Element will throw an attribute error due to the following line from Element.__init__():

self._userlabels: list[Label] = self._userlabels if self._userlabels else []

This code is not included in the version distributed by PyPI and is instead replaced by:

self._userlabels: list[Label] = []

which obviously works just fine.

I could not find a way to verify if @cdelker is the maintainer of the conda-forge package, but thought I would let you know in case you have access to change this.

Cheers,

Ian

cdelker commented 4 months ago

I don't maintain the conda-forge package for schemdraw - perhaps @dkozel could help?

I wasn't able to reproduce this in a clean conda environment (both Python 3.12 and 3.8 on Linux) though. It's odd since the line

self._userlabels: list[Label] = []

has been around since schemdraw v0.9, and I don't think it's ever looked like the one that's broken from what I can tell. I'm not able to check on Windows or Mac at the moment.

ibrummel commented 4 months ago

Thanks for looking into that. I am not sure where it came from either. I failed to mention that I tried with a clean Conda/Python 3.12 environment in Windows 11 and was able to replicate this behavior, so I don't think it was unique to my other environment setup/package list.

The following packages were installed as part of generating the environment for me:

asttokens                 2.4.1              pyhd8ed1ab_0    conda-forge
bzip2                     1.0.8                hcfcfb64_5    conda-forge
ca-certificates           2024.2.2             h56e8100_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
exceptiongroup            1.2.0              pyhd8ed1ab_2    conda-forge
executing                 2.0.1              pyhd8ed1ab_0    conda-forge
ipython                   8.22.2             pyh7428d3b_0    conda-forge
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
libexpat                  2.6.2                h63175ca_0    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libsqlite                 3.45.3               hcfcfb64_0    conda-forge
libzlib                   1.2.13               hcfcfb64_5    conda-forge
matplotlib-inline         0.1.7              pyhd8ed1ab_0    conda-forge
openssl                   3.2.1                hcfcfb64_1    conda-forge
parso                     0.8.4              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.42             pyha770c72_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pygments                  2.17.2             pyhd8ed1ab_0    conda-forge
python                    3.12.3          h2628c8c_0_cpython    conda-forge
schemdraw                 0.18               pyhd8ed1ab_0    conda-forge
setuptools                69.5.1             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h5226925_1    conda-forge
traitlets                 5.14.3             pyhd8ed1ab_0    conda-forge
typing-extensions         4.11.0               hd8ed1ab_0    conda-forge
typing_extensions         4.11.0             pyha770c72_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
vc                        14.3                hcf57466_18    conda-forge
vc14_runtime              14.38.33130         h82b7239_18    conda-forge
vs2015_runtime            14.38.33130         hcb4865c_18    conda-forge
wcwidth                   0.2.13             pyhd8ed1ab_0    conda-forge
wheel                     0.43.0             pyhd8ed1ab_1    conda-forge
xz                        5.2.6                h8d14728_0    conda-forge

Please let me know if I can help hunt this down at all.

dkozel commented 4 months ago

Thanks for tagging me. The conda-forge release directly uses the PyPi upstream code. https://github.com/conda-forge/schemdraw-feedstock/blob/main/recipe/meta.yaml#L8-L10

0.18 has been using this tarball: https://pypi.io/packages/source/s/schemdraw/schemdraw-0.18.tar.gz

I just checked the conda-forge package file for 0.18 and it has the correct line of code in it: https://anaconda.org/conda-forge/schemdraw/0.18/download/noarch/schemdraw-0.18-pyhd8ed1ab_0.conda

I've just updated to 0.19, thanks for the release Collin, and it is now available on conda-forge. https://anaconda.org/conda-forge/schemdraw https://anaconda.org/conda-forge/schemdraw/files

@ibrummel I think there must be some contamination of your system. Multiple installations from different python environments? I know my Windows 11 system is currently a mess of at least five different Python ecosystems which occasionally overlap and create problems.

ibrummel commented 4 months ago

@dkozel Thank you for checking into this. I guess it must be specific to my system but I am not sure what would be generating the issues. Although the only python installations that I have on my system are Conda environments, Conda can sure be obtuse sometimes and break in strange ways.

In any case, if the issue is system specific and you all aren't having issues, I am going to mark this closed, and maybe I will try totally wiping out my Conda installation and reinstalling everything.

Cheers!

dkozel commented 4 months ago

Let me know if you aren't able to get this working with the new release and possibly a new conda install. I'm tied up for the next week, but can do a clean test locally after the 12th.

ibrummel commented 4 months ago

I went ahead and fully wiped my Anaconda install yesterday and reinstalled both the 0.18 and 0.19 releases with success. I am at a loss as to what I had done previously to cause the issue but it looks like it was definitely some sort of overlap from previous work/other installations. Definitely on my end, I just thought it was coming from conda-forge because I had generated a fresh environment and re-installed shemdraw to test.