Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

name 'sys' is not defined

1,176 views
Skip to first unread message

safi...@gmail.com

unread,
Dec 30, 2019, 12:21:06 AM12/30/19
to
Deal all,
Could you please help me how can I avoid this problem
my Jupyter Notebook code was
help pls



# init a treemix analysis object with some param arguments
tmx = ipa.treemix(
data=data,
imap=imap,
minmap=minmap,
seed=123456,
root="Petronia_petronia",
m=2,
)

error

NameError Traceback (most recent call last)
<ipython-input-8-d80ffd5719d7> in <module>
6 seed=123456,
7 root="Petronia_petronia",
----> 8 m=2,
9 )

~/opt/miniconda3/envs/py3/lib/python3.6/site-packages/ipyrad/analysis/treemix.py in __init__(self, data, name, workdir, imap, minmap, seed, quiet, raise_root_error, binary, *args, **kwargs)
118
119 # others
--> 120 self.binary = os.path.join(sys.prefix, "bin", "treemix")
121 self.binary = (binary if binary else self.binary)
122 self.raise_root_error = raise_root_error

NameError: name 'sys' is not defined

Frank Millman

unread,
Dec 30, 2019, 12:50:11 AM12/30/19
to
On 2019-12-30 7:20 AM, safi...@gmail.com wrote:
> Deal all,
> Could you please help me how can I avoid this problem
> my Jupyter Notebook code was
> help pls
>
[snip]
>
> NameError: name 'sys' is not defined
>

I know nothing about Jupyter Notebook but somewhere, usually at the top,
you have to add this line -

import sys

HTH

Frank Millman


Frank Millman

unread,
Dec 30, 2019, 12:50:11 AM12/30/19
to
On 2019-12-30 7:20 AM, safi...@gmail.com wrote:
> Deal all,
> Could you please help me how can I avoid this problem
> my Jupyter Notebook code was
> help pls
>
[snip]
>
> NameError: name 'sys' is not defined
>

Pieter van Oostrum

unread,
Dec 30, 2019, 10:05:16 AM12/30/19
to
As the name sys is used in the imported module, that module has to import sys.
Importing it in the calling code doesn't help.
So I would say this is a bug in the module.

You should report the bug to its author. In the meantime you can correct your own copy at
~/opt/miniconda3/envs/py3/lib/python3.6/site-packages/ipyrad/analysis/treemix.py
by adding
import sys
for example around line 10

--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
0 new messages