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

Notebooks no longer compatible with PyPi release. #45

Closed
CompRhys opened this issue Oct 6, 2021 · 6 comments
Closed

Notebooks no longer compatible with PyPi release. #45

CompRhys opened this issue Oct 6, 2021 · 6 comments

Comments

@CompRhys
Copy link

CompRhys commented Oct 6, 2021

Was attempting to run the BaTiO3 notebook on colab and have had some errors installing from pip as that notebooks do not match the release.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-17-d8c3c8f46d03> in <module>()
      7     allow_gas_release=True,
      8     confine_competing_to_icsd=False,
----> 9     add_elements=['C']
     10 )

TypeError: __init__() got an unexpected keyword argument 'confine_competing_to_icsd'
@CompRhys
Copy link
Author

CompRhys commented Oct 6, 2021

installing the git package directly, i.e. pip install git+https://github.com/TRI-AMDD/piro.git, yeilds more errors due to pymatgen version not being specified and a change in the pymatgen API for MPRester where they removed top level imports.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-8a4e35725ecd> in <module>()
      1 import pandas as pd
----> 2 from piro.route import SynthesisRoutes
      3 pd.set_option('display.width', 700)
      4 pd.set_option('display.max_colwidth', 300)

/usr/local/lib/python3.7/dist-packages/piro/route.py in <module>()
      9 import json
     10 from copy import deepcopy
---> 11 from pymatgen import MPRester
     12 from pymatgen.analysis.phase_diagram import PhaseDiagram
     13 from pymatgen.util.string import latexify

ImportError: cannot import name 'MPRester' from 'pymatgen' (unknown location)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

@CompRhys
Copy link
Author

CompRhys commented Oct 6, 2021

Additionally the pip installation doesn't appear to package the resource directory RXN_FILES = os.path.join(RXN_ROOT, 'files') which can be seen by the lack of the files directory when we call tree on the install location.

!apt-get install tree
!tree /usr/local/lib/python3.7/dist-packages/piro/
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  tree
0 upgraded, 1 newly installed, 0 to remove and 37 not upgraded.
Need to get 40.7 kB of archives.
After this operation, 105 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 tree amd64 1.7.0-5 [40.7 kB]
Fetched 40.7 kB in 0s (123 kB/s)
Selecting previously unselected package tree.
(Reading database ... 155047 files and directories currently installed.)
Preparing to unpack .../tree_1.7.0-5_amd64.deb ...
Unpacking tree (1.7.0-5) ...
Setting up tree (1.7.0-5) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
/usr/local/lib/python3.7/dist-packages/piro/
├── data.py
├── __init__.py
├── mongodb.py
├── __pycache__
│   ├── data.cpython-37.pyc
│   ├── __init__.cpython-37.pyc
│   ├── mongodb.cpython-37.pyc
│   ├── route.cpython-37.pyc
│   └── utils.cpython-37.pyc
├── route.py
└── utils.py

@JosephMontoya-TRI
Copy link
Contributor

Thanks for the tip! Will debug today.

@JosephMontoya-TRI
Copy link
Contributor

Updated the release to include the files directory, it's working for me on colab now, will you test and let me know?

@CompRhys
Copy link
Author

CompRhys commented Oct 6, 2021

yep, now works! could be cool to have a Open In Colab example.

#@title Input Materials Project API KEY

!pip install git+https://github.com/TRI-AMDD/piro.git

MP_API_KEY = '<your api key here>' #@param {type:"string"}

!pmg config --add PMG_MAPI_KEY {MP_API_KEY}

all I needed to add was this cell at the top to do the config and then no other changes

@CompRhys CompRhys closed this as completed Oct 6, 2021
@sgbaird
Copy link

sgbaird commented Jan 25, 2022

Ditto on the colab example

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

3 participants