conda / conda-docs

Conda documentation
383 stars 510 forks source link

ImportError: Pandas requires version '3.1.0' or newer of 'openpyxl' #927

Closed mger1608 closed 3 months ago

mger1608 commented 8 months ago

Checklist

What happened?

I am trying to work with the 'openpyxl' library and pandas but receive the following error when I run my code.

ImportError                               Traceback (most recent call last)
Cell In[27], line 1
----> 1 message_data = (pd.read_excel('message_types.xlsx',
      2                               sheet_name='messages')
      3                 .sort_values('id')
      4                 .drop('id', axis=1))

File c:\PATH.py:495, in read_excel(io, sheet_name, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, date_format, thousands, decimal, comment, skipfooter, storage_options, dtype_backend, engine_kwargs)
    493 if not isinstance(io, ExcelFile):
    494     should_close = True
--> 495     io = ExcelFile(
    496         io,
    497         storage_options=storage_options,
    498         engine=engine,
    499         engine_kwargs=engine_kwargs,
    500     )
    501 elif engine and engine != io.engine:
    502     raise ValueError(
    503         "Engine should not be specified when passing "
    504         "an ExcelFile - ExcelFile already has the engine set"
    505     )

File c:\PATH.py:1567, in ExcelFile.__init__(self, path_or_buffer, engine, storage_options, engine_kwargs)
   1564 self.engine = engine
...
--> 164     raise ImportError(msg)
    165 else:
    166     return None

ImportError: Pandas requires version '3.1.0' or newer of 'openpyxl' (version '3.0.10' currently installed).

I use anaconda navigator and have verified that openpyxl is installed correctly but the Anaconda Navigator only lists openpyxl version 3.0.10 as the latest available version. I can install openpyxl version 3.1.2 using 'pip install' but don't know how to verify which version of pandas is compatible with openpyxl version 3.0.10 without having to also downgrade my python version which leads to a host of other dependencies.

Conda Info

active environment : AlgoTrading
    active env location : C:\Users\Michael\.conda\envs\AlgoTrading
            shell level : 2
       user config file : C:\Users\Michael\.condarc
 populated config files : C:\Users\Michael\.condarc
          conda version : 24.1.2
    conda-build version : 24.1.2
         python version : 3.11.7.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=x86_64
                          __conda=24.1.2=0
                          __win=0=0
       base environment : C:\ProgramData\anaconda3  (read only)
      conda av data dir : C:\ProgramData\anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\ProgramData\anaconda3\pkgs
                          C:\Users\Michael\.conda\pkgs
                          C:\Users\Michael\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\Michael\.conda\envs
                          C:\ProgramData\anaconda3\envs
                          C:\Users\Michael\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/24.1.2 requests/2.31.0 CPython/3.11.7 Windows/10 Windows/10.0.22631 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.6 aau/0.4.3 c/c2GstZmKFTPZxhS6aT4QLw s/rT3Jfu4gDLo9mbA3zfjm5Q e/040pgTmaGEzN20gtVVu15A
          administrator : False
             netrc file : None
           offline mode : False

Conda Config

==> C:\Users\Michael\.condarc <==
ssl_verify: True
channels:
  - defaults

Conda list

# packages in environment at C:\Users\Michael\.conda\envs\AlgoTrading:
#
# Name                    Version                   Build  Channel
annotated-types           0.6.0                    pypi_0    pypi
anyio                     4.3.0                    pypi_0    pypi
asttokens                 2.0.5              pyhd3eb1b0_0    defaults
beautifulsoup4            4.12.3                   pypi_0    pypi
blas                      1.0                         mkl    defaults
blosc                     1.21.3               h6c2663c_0    defaults
bottleneck                1.3.7           py312he558020_0    defaults
brotli                    1.0.9                h2bbff1b_7    defaults
brotli-bin                1.0.9                h2bbff1b_7    defaults
brotli-python             1.0.9           py312hd77b12b_7    defaults
bzip2                     1.0.8                h2bbff1b_5    defaults
c-blosc2                  2.12.0               h2f4ed9d_0    defaults
ca-certificates           2023.12.12           haa95532_0    defaults
certifi                   2024.2.2        py312haa95532_0    defaults
charset-normalizer        3.3.2                    pypi_0    pypi
colorama                  0.4.6           py312haa95532_0    defaults
comm                      0.2.1           py312haa95532_0    defaults
contourpy                 1.2.0           py312h59b6b97_0    defaults
cycler                    0.11.0             pyhd3eb1b0_0    defaults
debugpy                   1.6.7           py312hd77b12b_0    defaults
decorator                 5.1.1              pyhd3eb1b0_0    defaults
edgartools                2.11.0                   pypi_0    pypi
et_xmlfile                1.1.0           py312haa95532_1    defaults
executing                 0.8.3              pyhd3eb1b0_0    defaults
expat                     2.5.0                hd77b12b_0    defaults
fastcore                  1.5.29                   pypi_0    pypi
fonttools                 4.25.0             pyhd3eb1b0_0    defaults
freetype                  2.12.1               ha860e81_0    defaults
h11                       0.14.0                   pypi_0    pypi
hdf5                      1.12.1               h51c971a_3    defaults
httpcore                  1.0.4                    pypi_0    pypi
httpx                     0.27.0                   pypi_0    pypi
humanize                  4.9.0                    pypi_0    pypi
icc_rt                    2022.1.0             h6049295_2    defaults
icu                       73.1                 h6c2663c_0    defaults
idna                      3.4             py312haa95532_0    defaults
intel-openmp              2023.1.0         h59b6b97_46320    defaults
ipykernel                 6.28.0          py312haa95532_0    defaults
ipython                   8.20.0          py312haa95532_0    defaults
jedi                      0.18.1          py312haa95532_1    defaults
jpeg                      9e                   h2bbff1b_1    defaults
jupyter_client            8.6.0           py312haa95532_0    defaults
jupyter_core              5.5.0           py312haa95532_0    defaults
kiwisolver                1.4.4           py312hd77b12b_0    defaults
krb5                      1.20.1               h5b6d351_0    defaults
lerc                      3.0                  hd77b12b_0    defaults
libbrotlicommon           1.0.9                h2bbff1b_7    defaults
libbrotlidec              1.0.9                h2bbff1b_7    defaults
libbrotlienc              1.0.9                h2bbff1b_7    defaults
libclang                  14.0.6          default_hb5a9fac_1    defaults
libclang13                14.0.6          default_h8e68704_1    defaults
libdeflate                1.17                 h2bbff1b_1    defaults
libffi                    3.4.4                hd77b12b_0    defaults
libiconv                  1.16                 h2bbff1b_2    defaults
libpng                    1.6.39               h8cc25b3_0    defaults
libpq                     12.17                h906ac69_0    defaults
libsodium                 1.0.18               h62dcd97_0    defaults
libtiff                   4.5.1                hd77b12b_0    defaults
libwebp-base              1.3.2                h2bbff1b_0    defaults
libxml2                   2.10.4               h0ad7f3c_1    defaults
libxslt                   1.1.37               h2bbff1b_1    defaults
lxml                      4.9.3           py312h09808a7_0    defaults
lz4-c                     1.9.4                h2bbff1b_0    defaults
lzo                       2.10                 he774522_2    defaults
markdown-it-py            3.0.0                    pypi_0    pypi
markdownify               0.11.6                   pypi_0    pypi
matplotlib                3.8.0           py312haa95532_0    defaults
matplotlib-base           3.8.0           py312hc7c4135_0    defaults
matplotlib-inline         0.1.6           py312haa95532_0    defaults
mdurl                     0.1.2                    pypi_0    pypi
mkl                       2023.1.0         h6b88ed4_46358    defaults
mkl-service               2.4.0           py312h2bbff1b_1    defaults
mkl_fft                   1.3.8           py312h2bbff1b_0    defaults
mkl_random                1.2.4           py312h59b6b97_0    defaults
munkres                   1.1.4                      py_0    defaults
nest-asyncio              1.6.0           py312haa95532_0    defaults
numexpr                   2.8.7           py312h96b7d27_0    defaults
numpy                     1.26.4          py312hfd52020_0    defaults
numpy-base                1.26.4          py312h4dde369_0    defaults
openjpeg                  2.4.0                h4fc8c34_0    defaults
openpyxl                  3.1.2                    pypi_0    pypi
openssl                   3.0.13               h2bbff1b_0    defaults
packaging                 23.1            py312haa95532_0    defaults
pandas                    2.2.1           py312h0158946_0    defaults
pandas-datareader         0.10.0             pyhd3eb1b0_0    defaults
parso                     0.8.3              pyhd3eb1b0_0    defaults
pillow                    10.2.0          py312h2bbff1b_0    defaults
pip                       23.3.1          py312haa95532_0    defaults
platformdirs              3.10.0          py312haa95532_0    defaults
ply                       3.11            py312haa95532_1    defaults
powershell_shortcut       0.0.1                         3    defaults
prompt-toolkit            3.0.43          py312haa95532_0    defaults
prompt_toolkit            3.0.43               hd3eb1b0_0    defaults
psutil                    5.9.0           py312h2bbff1b_0    defaults
pure_eval                 0.2.2              pyhd3eb1b0_0    defaults
py                        1.11.0                   pypi_0    pypi
py-cpuinfo                9.0.0           py312haa95532_0    defaults
pyarrow                   15.0.1                   pypi_0    pypi
pydantic                  2.6.4                    pypi_0    pypi
pydantic-core             2.16.3                   pypi_0    pypi
pygments                  2.15.1          py312haa95532_1    defaults
pyparsing                 3.0.9           py312haa95532_0    defaults
pyqt                      5.15.10         py312hd77b12b_0    defaults
pyqt5-sip                 12.13.0         py312h2bbff1b_0    defaults
pysocks                   1.7.1           py312haa95532_0    defaults
pytables                  3.9.2           py312h2314d3b_0    defaults
python                    3.12.2               h1d929f7_0    defaults
python-dateutil           2.8.2              pyhd3eb1b0_0    defaults
python-tzdata             2023.3             pyhd3eb1b0_0    defaults
pytz                      2023.3.post1    py312haa95532_0    defaults
pywin32                   305             py312h2bbff1b_0    defaults
pyzmq                     25.1.2          py312hd77b12b_0    defaults
qt-main                   5.15.2              h19c9488_10    defaults
rank-bm25                 0.2.1                    pypi_0    pypi
requests                  2.31.0          py312haa95532_1    defaults
retry                     0.9.2                    pypi_0    pypi
rich                      13.7.1                   pypi_0    pypi
seaborn                   0.12.2          py312haa95532_0    defaults
setuptools                68.2.2          py312haa95532_0    defaults
sip                       6.7.12          py312hd77b12b_0    defaults
six                       1.16.0             pyhd3eb1b0_1    defaults
sniffio                   1.3.1                    pypi_0    pypi
soupsieve                 2.5                      pypi_0    pypi
sqlite                    3.41.2               h2bbff1b_0    defaults
stack_data                0.2.0              pyhd3eb1b0_0    defaults
tbb                       2021.8.0             h59b6b97_0    defaults
textdistance              4.6.1                    pypi_0    pypi
tk                        8.6.12               h2bbff1b_0    defaults
tornado                   6.3.3           py312h2bbff1b_0    defaults
tqdm                      4.65.0          py312hfc267ef_0    defaults
traitlets                 5.7.1           py312haa95532_0    defaults
typing-extensions         4.10.0                   pypi_0    pypi
tzdata                    2024a                h04d1e81_0    defaults
urllib3                   2.1.0           py312haa95532_1    defaults
vc                        14.2                 h21ff451_1    defaults
vs2015_runtime            14.27.29016          h5e58377_2    defaults
wcwidth                   0.2.5              pyhd3eb1b0_0    defaults
wheel                     0.41.2          py312haa95532_0    defaults
win_inet_pton             1.1.0           py312haa95532_0    defaults
xz                        5.4.6                h8cc25b3_0    defaults
zeromq                    4.3.5                hd77b12b_0    defaults
zlib                      1.2.13               h8cc25b3_0    defaults
zlib-ng                   2.0.7                h2bbff1b_0    defaults
zstd                      1.5.5                hd43e919_0    defaults

Additional Context

No response

kathatherine commented 3 months ago

Hi, @mger1608, thank you for your patience with this. I'm sorry you've had these difficulties, but this is not an issue we can solve in this repository. Navigator is an Anaconda product that is built on the conda package manager (and also, this repo is for the landing page of the docs.conda.io only). I suggest you open an issue in Anaconda Issues and/or make a post in the Anaconda Community Forums. Thank you!