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

PyPi package fails to install and run #5

Closed
BoltzmannBrain opened this issue Aug 14, 2019 · 6 comments
Closed

PyPi package fails to install and run #5

BoltzmannBrain opened this issue Aug 14, 2019 · 6 comments

Comments

@BoltzmannBrain
Copy link

Creating a python 3.6.0 virtual environment and running pip install causallib succeeds, but then trying to import any modules fails. E.g. from causallib.estimation import IPW:

...

~/.pyenv/versions/3.6.0/envs/venv360/lib/python3.6/site-packages/pandas/core/frame.py in <module>
     86 from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin as DatetimeLikeArray
     87 from pandas.core.arrays.sparse import SparseFrameAccessor
---> 88 from pandas.core.generic import NDFrame, _shared_docs
     89 from pandas.core.index import (
     90     Index,

~/.pyenv/versions/3.6.0/envs/venv360/lib/python3.6/site-packages/pandas/core/generic.py in <module>
     69 from pandas.core.ops import _align_method_FRAME
     70 
---> 71 from pandas.io.formats.format import DataFrameFormatter, format_percentiles
     72 from pandas.io.formats.printing import pprint_thing
     73 from pandas.tseries.frequencies import to_offset

~/.pyenv/versions/3.6.0/envs/venv360/lib/python3.6/site-packages/pandas/io/formats/format.py in <module>
     45 from pandas.core.indexes.datetimes import DatetimeIndex
     46 
---> 47 from pandas.io.common import _expand_user, _stringify_path
     48 from pandas.io.formats.printing import adjoin, justify, pprint_thing
     49 

~/.pyenv/versions/3.6.0/envs/venv360/lib/python3.6/site-packages/pandas/io/common.py in <module>
      7 from http.client import HTTPException  # noqa
      8 from io import BytesIO
----> 9 import lzma
     10 import mmap
     11 import os

~/.pyenv/versions/3.6.0/lib/python3.6/lzma.py in <module>
     25 import io
     26 import os
---> 27 from _lzma import *
     28 from _lzma import _encode_filter_properties, _decode_filter_properties
     29 import _compression

ModuleNotFoundError: No module named '_lzma'

It looks like there are versioning issues with pandas.

@BoltzmannBrain
Copy link
Author

Okay downgrading to pandas 0.24.2 solves this. I think 0.25 assumes lzma to be available from stdlib, but it's not.

@yishaishimoni
Copy link
Collaborator

Thanks @BoltzmannBrain !
We will update the requirement files as a first quick-fix.
Later we will check if this can be solved to allow pandas 0.25

@ehudkr
Copy link
Collaborator

ehudkr commented Aug 15, 2019

Hey @BoltzmannBrain,
first of all, let me congratulate you for opening causallib's first issue! 🎉 I don't know about you, but I'm quite excited 😊

Now, as for the issue itself. I was not able to reproduce the problem using conda environment, so I did some further digging.
It seems to be a recently raised issue in the interface between pyenv and pandas. see:

Could you please try to simply import pandas as pd in your environment?
If I understood those discussions correctly, it suppose to fail, making it a pandas/pyenv issue rather than a direct causallib one (i.e., it is not caused by how causallib uses pandas, but rather causallib fails to import pandas to begin with. Meaning it would've happen if you were to simply install pandas in your environment, rather than installing it as a causallib dependency).

@guilherme-salome
Copy link

guilherme-salome commented Aug 19, 2019

Depending on how Python is installed in your system, the module lzma will not be available (I first found this after installing Python with pyenv on MacOS). This is due to a lack of the appropriate dependencies when compiling Python.
Since pandas uses that module, you end up with the No module found error message.
On release 0.25.1 of pandas the issue will be fixed. If your Python is not properly installed (i.e. lzma not available) you will get a warning message when importing pandas, but pandas will be imported. However, calling any function that requires compression via lzma will still fail.

@ehudkr
Copy link
Collaborator

ehudkr commented Aug 20, 2019

Thanks for contributing your bug-fix, @salompas.
@BoltzmannBrain, feel free to update if this fixes that for you. Unless you or anyone else objects, I think we can close this issue, as it is not directly causallib related.

@BoltzmannBrain
Copy link
Author

+1 on @salompas's assessment. Thank you for addressing the issue!

@ehudkr ehudkr closed this as completed Aug 26, 2019
mmdanziger pushed a commit to mmdanziger/causallib that referenced this issue Jul 13, 2022
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

4 participants