-
Notifications
You must be signed in to change notification settings - Fork 41
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
AttributeError: module 'numpy' has no attribute 'asscalar' #498
Comments
I tried out the STRUCTURE cookbook and have hit a snag there as well. It reports the same error: AttributeError: module 'numpy' has no attribute 'asscalar' as well as another: AttributeError: module 'collections' has no attribute 'Sequence' AttributeError Traceback (most recent call last) File ~/miniconda3/lib/python3.10/site-packages/ipyrad/analysis/pca.py:405, in PCA.draw(self, ax0, ax1, cycle, colors, opacity, shapes, size, legend, label, outfile, imap, width, height, axes, **kwargs) File ~/miniconda3/lib/python3.10/site-packages/ipyrad/analysis/pca.py:648, in Drawing.init(self, pcatool, ax0, ax1, cycle, colors, opacity, shapes, size, legend, label, outfile, imap, width, height, axes, **kwargs) File ~/miniconda3/lib/python3.10/site-packages/ipyrad/analysis/pca.py:773, in Drawing._get_marker_styles(self) File ~/miniconda3/lib/python3.10/site-packages/toyplot/color.py:205, in broadcast(colors, shape, default) AttributeError: module 'collections' has no attribute 'Sequence' AttributeError Traceback (most recent call last) File ~/miniconda3/lib/python3.10/site-packages/toyplot/canvas.py:229, in Canvas.repr_html(self) File ~/miniconda3/lib/python3.10/site-packages/toyplot/html.py:370, in tostring(canvas, style) File ~/miniconda3/lib/python3.10/site-packages/toyplot/html.py:330, in render(canvas, fobj, animation, style) File ~/miniconda3/lib/python3.10/site-packages/multipledispatch/dispatcher.py:278, in Dispatcher.call(self, *args, **kwargs) File ~/miniconda3/lib/python3.10/site-packages/toyplot/html.py:796, in _render(canvas, context) File ~/miniconda3/lib/python3.10/site-packages/multipledispatch/dispatcher.py:278, in Dispatcher.call(self, *args, **kwargs) File ~/miniconda3/lib/python3.10/site-packages/toyplot/html.py:1944, in _render(canvas, axes, context) File ~/miniconda3/lib/python3.10/site-packages/multipledispatch/dispatcher.py:278, in Dispatcher.call(self, *args, **kwargs) File ~/miniconda3/lib/python3.10/site-packages/toyplot/html.py:1446, in _render(canvas, axis, context) File ~/miniconda3/lib/python3.10/site-packages/toyplot/projection.py:173, in Piecewise.call(self, domain_values) File ~/miniconda3/lib/python3.10/site-packages/numpy/init.py:311, in getattr(attr) AttributeError: module 'numpy' has no attribute 'asscalar' |
What version of toyplot do you have installed? The 'asscalar' error is coming from toyplot and this has been fixed already (sandialabs/toyplot#205) , so make sure your toyplot version is > 1.0.2. The Collections.Sequence error is also fixed in the most recent versions of toyplot (sandialabs/toyplot#202). Please update your toyplot version and try again and let me know how it goes. |
Thanks. Yes i had an older version of toyplot. I've now done a fresh install of ipyrad in a clean environment and have got past that error and onto another... Im still using the STRUCTURE jupyter notebook and everything seems ok now up till the "Analyze results: Barplots" step. There seems to be some kind of an issue with clumpp? I do have clumpp installed v 1.1.2. Any advice is much appreciated. many thanks: k = 3 OSError Traceback (most recent call last) File ~/miniconda3/envs/ipyrad1/lib/python3.8/site-packages/ipyrad/analysis/structure.py:584, in Structure.get_clumpp_table(self, kvalues, max_var_multiple, quiet) File ~/miniconda3/envs/ipyrad1/lib/python3.8/site-packages/ipyrad/analysis/structure.py:873, in _get_clumpp_table(self, kpop, max_var_multiple, quiet) File ~/miniconda3/envs/ipyrad1/lib/python3.8/subprocess.py:858, in Popen.init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text) File ~/miniconda3/envs/ipyrad1/lib/python3.8/subprocess.py:1704, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session) OSError: [Errno 86] Bad CPU type in executable: '/Users/Lalita/miniconda3/envs/ipyrad1/bin/CLUMPP' |
I will guess that you are working on a mac with an M1 processor? The clumpp binary is only available at the moment for intel macs, so i will have to take a closer look to figure out how to fix this. Let me know if what I think about your mac processor is correct. |
Hi Isaac, I am on a mac but i have one of the last with an intel processor as I wanted to avoid compatibility issues with the M processors. I am on a macbook pro, 2 GHz Quad-Core Intel Core i5 processor, 16BG memory. Any other ideas? Thanks. |
Can you try this and show me the result?
Mine works and mine looks like this: Can you also show results for this?
|
Hi @isaacovercast. I too am running into problems using CLUMPP with an M2 silicon chip. I also tried installing Rosetta 2 and specifying the 64 bit architecture, as suggested here. No effect.
As requested:
|
Hi Alex, Well, it looks like Rosetta doesn't support 32bit binaries, so that's going to be hard to work around. I will make a new issue to build and push a 64bit binary, but it won't happen any time soon, sorry to say. Best workaround now is to find an intel box unfortunately. |
Thanks for making the issue. I figured it'd be low priority, no worries at all. At the very least I can run Structure on the fast M2 chips with the parallelization that |
Hi ipyrad team, thanks for all the tools! I am trying out the PCA cookbook but hit this error at the 'Run PCA and plot results' step:
AttributeError Traceback (most recent call last)
Cell In[34], line 2
1 # plot PC axes 0 and 2
----> 2 pca.draw(0, 2);
File ~/miniconda3/lib/python3.10/site-packages/ipyrad/analysis/pca.py:405, in PCA.draw(self, ax0, ax1, cycle, colors, opacity, shapes, size, legend, label, outfile, imap, width, height, axes, **kwargs)
385 def draw(
386 self,
387 ax0=0,
(...)
400 axes=None,
401 **kwargs):
402 """
403 Draw a scatterplot for data along two PC axes.
404 """
--> 405 self.drawing = Drawing(
406 self, ax0, ax1, cycle, colors, opacity, shapes, size, legend,
407 label, outfile, imap, width, height, axes,
408 **kwargs)
409 return self.drawing.canvas, self.drawing.axes
File ~/miniconda3/lib/python3.10/site-packages/ipyrad/analysis/pca.py:648, in Drawing.init(self, pcatool, ax0, ax1, cycle, colors, opacity, shapes, size, legend, label, outfile, imap, width, height, axes, **kwargs)
646 self.rstyles = {}
647 self.pstyles = {}
--> 648 self._get_marker_styles()
649 self._assign_styles_to_marks()
650 self._draw_markers()
File ~/miniconda3/lib/python3.10/site-packages/ipyrad/analysis/pca.py:773, in Drawing._get_marker_styles(self)
770 # get color list repeating in cycles of cycle
771 if not self.colors:
772 self.colors = itertools.cycle(
--> 773 toyplot.color.broadcast(
774 toyplot.color.brewer.map("Spectral"), shape=self.cycle,
775 )
776 )
777 else:
778 self.colors = itertools.cycle(self.colors)
File ~/miniconda3/lib/python3.10/site-packages/toyplot/color.py:205, in broadcast(colors, shape, default)
202 colors, colormap = colors
204 # Next, convert the supplied colors into a toyplot color array.
--> 205 if isinstance(colors, collections.Sequence):
206 colors = numpy.array(colors)
208 if isinstance(colors, numpy.ndarray):
AttributeError: module 'collections' has no attribute 'Sequence'
AttributeError Traceback (most recent call last)
File ~/miniconda3/lib/python3.10/site-packages/IPython/core/formatters.py:342, in BaseFormatter.call(self, obj)
340 method = get_real_method(obj, self.print_method)
341 if method is not None:
--> 342 return method()
343 return None
344 else:
File ~/miniconda3/lib/python3.10/site-packages/toyplot/canvas.py:229, in Canvas.repr_html(self)
227 def repr_html(self):
228 from . import html
--> 229 return toyplot.html.tostring(self, style={"text-align":"center"})
File ~/miniconda3/lib/python3.10/site-packages/toyplot/html.py:370, in tostring(canvas, style)
344 def tostring(canvas, style=None):
345 """Convert a canvas to its HTML string representation.
346
347 Generates HTML markup with an embedded SVG representation of the canvas, plus
(...)
368 etc. if the result is intended as a standalone HTML document.
369 """
--> 370 return six.text_type(xml.tostring(render(canvas=canvas, style=style), encoding="utf-8", method="html"), encoding="utf-8")
File ~/miniconda3/lib/python3.10/site-packages/toyplot/html.py:330, in render(canvas, fobj, animation, style)
324 context.define("toyplot/root", ["toyplot/root/id"], factory="""function(root_id)
325 {
326 return document.querySelector("#" + root_id);
327 }""")
329 # Render the canvas.
--> 330 _render(canvas, context.copy(parent=root_xml)) # pylint: disable=no-value-for-parameter
332 # Return / write the results.
333 if isinstance(fobj, six.string_types):
File ~/miniconda3/lib/python3.10/site-packages/multipledispatch/dispatcher.py:278, in Dispatcher.call(self, *args, **kwargs)
276 self._cache[types] = func
277 try:
--> 278 return func(*args, **kwargs)
280 except MDNotImplementedError:
281 funcs = self.dispatch_iter(*types)
File ~/miniconda3/lib/python3.10/site-packages/toyplot/html.py:796, in _render(canvas, context)
794 # Render everything on the canvas.
795 for child in canvas._children:
--> 796 _render(canvas, child._finalize(), context.copy(parent=svg_xml))
798 # Create a container for any Javascript code.
799 javascript_xml = xml.SubElement(
800 context.parent,
801 "div",
802 attrib={"class": "toyplot-behavior"},
803 )
File ~/miniconda3/lib/python3.10/site-packages/multipledispatch/dispatcher.py:278, in Dispatcher.call(self, *args, **kwargs)
276 self._cache[types] = func
277 try:
--> 278 return func(*args, **kwargs)
280 except MDNotImplementedError:
281 funcs = self.dispatch_iter(*types)
File ~/miniconda3/lib/python3.10/site-packages/toyplot/html.py:1944, in _render(canvas, axes, context)
1941 _render(axes, child._finalize(), context.copy(parent=children_xml))
1943 if axes._show:
-> 1944 _render(canvas, axes.x, context.copy(parent=cartesian_xml))
1945 _render(canvas, axes.y, context.copy(parent=cartesian_xml))
1946 _draw_text(
1947 root=cartesian_xml,
1948 text=axes.label._text,
(...)
1951 style=axes.label._style,
1952 )
File ~/miniconda3/lib/python3.10/site-packages/multipledispatch/dispatcher.py:278, in Dispatcher.call(self, *args, **kwargs)
276 self._cache[types] = func
277 try:
--> 278 return func(*args, **kwargs)
280 except MDNotImplementedError:
281 funcs = self.dispatch_iter(*types)
File ~/miniconda3/lib/python3.10/site-packages/toyplot/html.py:1446, in _render(canvas, axis, context)
1439 ticks_group = xml.SubElement(axis_xml, "g")
1440 for location, label, title, label_style in zip(
1441 axis._tick_locations,
1442 axis._tick_labels,
1443 axis._tick_titles,
1444 axis.ticks.labels.label.styles(axis._tick_locations),
1445 ):
-> 1446 x = axis.projection(location)
1448 style = toyplot.style.combine(
1449 {
1450 "-toyplot-vertical-align": vertical_align,
(...)
1454 label_style,
1455 )
1457 _draw_text(
1458 root=ticks_group,
1459 text=label,
(...)
1464 title=title,
1465 )
File ~/miniconda3/lib/python3.10/site-packages/toyplot/projection.py:173, in Piecewise.call(self, domain_values)
170 raise Exception("Unknown scale: %s" % (scale,)) # pragma: no cover
172 if range_values.shape == ():
--> 173 range_values = numpy.asscalar(range_values)
174 return range_values
File ~/miniconda3/lib/python3.10/site-packages/numpy/init.py:311, in getattr(attr)
308 from .testing import Tester
309 return Tester
--> 311 raise AttributeError("module {!r} has no attribute "
312 "{!r}".format(name, attr))
AttributeError: module 'numpy' has no attribute 'asscalar'
Subsampling SNPs¶
The text was updated successfully, but these errors were encountered: