Comments (20)
Thanks @tomwagstaff-opml
The good news is that we continued to discuss this internally and we might have a direction of how to monkey-patch this problem (thanks to the wonderful @stevemandala ).
It's still being tested. We'll update here once we find something that seems to work. (Hopefully today but it might only get to happen next week).
T
from balance.
@tomwagstaff-opml great news:
@stevemandala just landed a patch to make balance support 3.11.
Could you please test to see if it works for you by installing it via:
python -m pip install git+https://github.com/facebookresearch/balance.git
And let us know how it goes?
from balance.
Sorry @tomwagstaff-opml
I honestly didn't expact @stevemandala to find a solution that fast :D
from balance.
Fascinating. Especially given that it runs fine on gh actions under 3.11.
What I think we might do is later today release balance 0.3.0 (which should support 3.11). Once it gets to pypi I'll ping here again and you can try installing it through pypi.
Thanks for helping us debug this.
from balance.
Ok, so it's not clear to me what's broken then :(
I suggest we leave this issue closed, and if you come across more issues - feel free to open new issues for them.
from balance.
This is an issue because of the dependancy of the IPW implementation on glmnet (which is getting to be old at this point).
We plan to move to sklearn by June, but that will take some time.
In the meantime, would using the package only with CBPS be good enough for your needs?
(Because if so, there is a hack we can discuss)
from balance.
Hi @talgalili !
Thanks for your speedy response.
Understand the constraint, and looking around it looks like the easiest solution is probably for me to roll back to Python 3.9 or something, so I'm working on that...
Having said that - my main interest in the package was road-testing CBPS (although I wanted to try all the methods it offers). So if there's an (easy) hack I'd be all ears :-)
from balance.
The hack (which I'm not sure how easy), is to fork the repo, manually change the setup.py to not restrict you to scipy 1.18, and then install the package from the fork.
You might also need to remove the dependancy on glmnet.
I haven't tried it, but I think it's worth a shot.
If you try it, could you please share how it went?
(P.s., whenever invoking sample.adjust you'll need to use method="cbps", since the default of "ipw" will not work)
from balance.
For our own reference, solving this issue depends on solving: #16
from balance.
Adding to @talgalili's summary, the main reason we pinned the scipy dependency is that glmnet_python relies on several scipy libraries that were deprecated & moved in 1.9.0 (full release notes here). Top of mind, glmnet_python relies on
scipy.random
at several code pointers
While resolving #16 would be the ideal mitigation, another route would be to migrate glmnet_python source to also support scipy 1.9.0+, e.g. migrating scipy.random
to numpy.random
. I submitted an issue at bbalasub1/glmnet_python#64 for tracking this.
from balance.
Thanks both - this all makes sense, and it doesn't sound quick or easy to address from your side (although I guess it's something you'll have to grapple with sooner or later). I'm happy to get hold of another version of Python to play with the package
from balance.
Oh gosh - I just had IT roll back my Python installation! I'll see if I can create a 3.11 environment to test it - but either way, thanks very much for your efforts @stevemandala
from balance.
I've tried installing and I'm afraid it refused to install in Python 3.11 :-(
Just to recap what I did - after the rollback I got miniconda installed and created a Python 3.11 environment to test the package. I conda install
ed git, and then tried to pip install
balance as per your command. It fails to install, with this really weird character encoding error, so who knows if that's real or a red herring...
The good news is I created a Python 3.10 environment and successfully pip installed balance
there - just from PyPi. I ran into the same error as below when I tried to install from GitHub, so maybe that's a clue as to where the problem is.
Cloning https://github.com/facebookresearch/balance.git to c:\users\twagstaff\appdata\local\temp\pip-req-build-feduampl
Running command git clone --filter=blob:none --quiet https://github.com/facebookresearch/balance.git 'C:\Users\twagstaff\AppData\Local\Temp\pip-req-build-feduampl'
Resolved https://github.com/facebookresearch/balance.git to commit c6f056f91a238b70cddccc97e685d6a654a91a63
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\twagstaff\AppData\Local\Temp\pip-req-build-feduampl\setup.py", line 90, in <module>
setup_package()
File "C:\Users\twagstaff\AppData\Local\Temp\pip-req-build-feduampl\setup.py", line 55, in setup_package
long_description = fh.read()
^^^^^^^^^
File "C:\Users\twagstaff\AppData\Local\miniconda3\envs\balance_311\Lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1494: character maps to <undefined>
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
from balance.
Thanks @tomwagstaff-opml
Just to double check, you used this code:
python -m pip install git+https://github.com/facebookresearch/balance.git
?
from balance.
Yes indeed - well actually just the pip install...
bit as I don't think I need to explicitly call python again once I'm in the environment
from balance.
@tomwagstaff-opml As @talgalili mentioned, this should be resolved for PyPi installs with the new release. I also have a quick fix for the UnicodeDecodeError
error as well, which was due to errors when decoding the utf-8 files on Windows: #28
This should fix the issue with builds from source directly
(Also want to echo Tal's thank you for your help raising and debugging these issues!)
from balance.
@tomwagstaff-opml - update: we've now landed a fix that should make installing from github on windows possible again.
Would you please try to reinstall balance on 3.11 from your windows machine using the github repo?
from balance.
I'm afraid that failed again, but I don't think it's on you.
The problem now is the dependency on pandas
. If I try to conda install it, I'm told it's not available for Python 3.11 - I think that must be a specific issue with the conda repos because it's listed as compatible on PyPi.
If I try to pip install balance
- and let pip take care of the pandas dependency - I'm prompted to install C++ first, which I'm afraid is an IT ticket too far for me 😅
from balance.
Oh my.
@tomwagstaff-opml :
We currently require pandas<=1.4.3
. Is the issue that we need to make sure we support pandas 1.5.0 or some other version?
(Please let us know - I'd be happy to open a ticket for this as well)
from balance.
Ahh, I think it might be - I'm using pandas 1.4.3. in the Python 3.10 environment...
from balance.
Related Issues (20)
- Can't use `method = "cbps"` (windows, Python 3.10) HOT 8
- When using the RStudio IDE to run Python: Seaborn plots not working HOT 6
- [FEATURE] Migrate from glmnet_python to sklearn HOT 2
- [BUG] libgfortran.so.3: cannot open shared object file when running sample_with_target.adjust(max_de=None) HOT 6
- [BUG] HOT 3
- [BUG] plots in quickstart tutorial are beyond the figure margins
- [BUG] simulation data of target is not the same is sample
- [FEATURE] add kl divergence metrics to covars()
- [FEATURE] Make `balance` API closer to the sklearn syntax
- [FEATURE] Chainging the way Sample take strategy for adjust HOT 1
- [FEATURE] Import the Empirical Calibration package to `adjust`
- [FEATURE] Move from patsy to formulaic
- [FEATURE] Update the printout of an adjusted object to include information about the correction used.
- [FEATURE] Update the printout of adjusted.summary() to include aspects of covars, weights and outcome
- [FEATURE] check (raise warning) if features are provided that lead to all equal weights
- Treatment in balance library for sample and target population HOT 3
- [BUG] rake doesn't support trimming - but also doesn't indicate it to the user HOT 1
- [BUG] method = 'rake' return AttributeError HOT 18
- [FEATURE] Raise error (or warning?!) when providing weights with 'None'
- [FEATURE] Weight trimming to match a specific design effect
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from balance.