Skip to content

Instantly share code, notes, and snippets.

@beckermr
Last active March 19, 2020 21:56
Show Gist options
  • Select an option

  • Save beckermr/9862deb8b1069e2543c318577c15739f to your computer and use it in GitHub Desktop.

Select an option

Save beckermr/9862deb8b1069e2543c318577c15739f to your computer and use it in GitHub Desktop.
conda forge graph getting started
#!/usr/bin/env bash
git clone https://github.com/regro/cf-scripts.git
pushd cf-scripts
pip install --no-deps -e .
popd
git clone --depth=1 https://github.com/regro/cf-graph-countyfair.git
cd cf-graph-countyfair
# run the python script here or start your interpreter
ipython
# type this code in at the interpreter
from conda_forge_tick.utils import load_graph
gx = load_graph()
# from here you can inspect the graph object
print("# of nodes:", len(gx.nodes))
with gx.nodes['python']['payload'] as attrs:
print('python node data:', attrs.data)
@viniciusdc
Copy link

right, done. But i have another problem: OSError: [Errno 22] Invalid argument: 'node_attrs/conda-forge::git.json'

@beckermr
Copy link
Author

post the full error?

@viniciusdc
Copy link

C:\Users\viniv\PycharmProjects\conda_forge\Program\lib\site-packages\github3\session.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Callable C:\Users\viniv\PycharmProjects\conda_forge\Program\lib\site-packages\github3\structs.py:11: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working class GitHubIterator(models.GitHubCore, collections.Iterator): Traceback (most recent call last): File "C:/Users/viniv/PycharmProjects/conda_forge/cf-graph-countyfair/load_graph.py", line 4, in <module> gx = load_graph() File "c:\users\viniv\pycharmprojects\conda_forge\cf-scripts\conda_forge_tick\utils.py", line 439, in load_graph nld = load(f) File "c:\users\viniv\pycharmprojects\conda_forge\cf-scripts\conda_forge_tick\utils.py", line 397, in load return json.load(fp, object_hook=object_hook, **kwargs) File "D:\Users\viniv\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 296, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "D:\Users\viniv\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 361, in loads return cls(**kw).decode(s) File "D:\Users\viniv\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "D:\Users\viniv\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) File "c:\users\viniv\pycharmprojects\conda_forge\cf-scripts\conda_forge_tick\utils.py", line 342, in object_hook return LazyJson(dct["__lazy_json__"]) File "c:\users\viniv\pycharmprojects\conda_forge\cf-scripts\conda_forge_tick\utils.py", line 110, in __init__ with open(self.file_name, "w") as f: OSError: [Errno 22] Invalid argument: 'node_attrs/conda-forge::git.json'

@beckermr
Copy link
Author

hmmmmmm....

@beckermr
Copy link
Author

that looks like a bug

@beckermr
Copy link
Author

rove that file and try again?

@viniciusdc
Copy link

if starts like this "hmmmmmm....", should i have something before, kind of using just the anaconda ?

@viniciusdc
Copy link

well, i tried again and got the same result. i will try something just a sec

@viniciusdc
Copy link

besides the directories and respective modules, should i've installed something else ?

@beckermr
Copy link
Author

you need the deps of cf-scripts ofc

@viniciusdc
Copy link

it was not in the script above, cause we set --no-deps -e m right ?

@beckermr
Copy link
Author

Yep. You need to get those from conda in the end. The cf-scripts repo has a list

@viniciusdc
Copy link

thanks, i found the missing ones. There is a script inside cf-scripts to auto install all of them ?

@beckermr
Copy link
Author

there is a list IIRC. You can use the --file argument to conda

@viniciusdc
Copy link

i've finished the downloads using conda, but the same error occurred, i will try launch the load_graph.py externally and see what happens. Sorry for all the work.

@viniciusdc
Copy link

there is a problem that happens every time i clone the cf-graph-countyfair:
error: invalid path 'node_attrs/conda-forge::git.json' fatal: unable to checkout working tree warning: Clone succeeded, but checkout failed. You can inspect what was checked out with 'git status' and retry with 'git restore --source=HEAD :/'

@beckermr
Copy link
Author

Can you rm node_attrs/conda-forge::git.json?

@viniciusdc
Copy link

C:\Users\viniv\cf-graph-countyfair>rm node_attrs/conda-forge::git.json rm: cannot remove 'node_attrs/conda-forge::git.json': No such file or directory

@beckermr
Copy link
Author

Well IDK. Maybe reclone everything and try again? I don't have a windows machine to test with. Do you have a linux box you can use?

@beckermr
Copy link
Author

beckermr commented Mar 18, 2020

@ocefpaf Any help here? I am stumped.

@beckermr
Copy link
Author

@viniciusdc
Copy link

Well IDK. Maybe reclone everything and try again? I don't have a windows machine to test with. Do you have a linux box you can use?

i can make one, but it will take a while

@ocefpaf
Copy link

ocefpaf commented Mar 18, 2020

I'm not on a Windows machine either. Let me see if I can get my hands on one to debug this.

@viniciusdc
Copy link

thanks @beckermr and @ocefpaf, i will try these steps on Linux, and see what happens.

@viniciusdc
Copy link

Ok, some news

@viniciusdc
Copy link

It happened again, but this time i could load the script.
python load_graph.py /home/drakar/miniconda3/lib/python3.7/site-packages/github3/session.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working from collections import Callable /home/drakar/miniconda3/lib/python3.7/site-packages/github3/structs.py:11: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working class GitHubIterator(models.GitHubCore, collections.Iterator): /home/drakar/miniconda3/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/_collections.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working from collections import Mapping, MutableMapping

@viniciusdc
Copy link

this was the expected answer ?
# of nodes: 9474 python node data: None

@beckermr
Copy link
Author

yup LGTM!

now you can start digging into the version harvesting code I sent!

@viniciusdc
Copy link

Heee, finaly. Probably it was something with windows. by "harvesting code I sent", it's this regro/cf-scripts#842 right ?

@beckermr
Copy link
Author

yup! let's move this discussion to that issue as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment