cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

Attributeerror for bool8 to bool in numpy?

Open ghxstweb opened this issue 1 year ago • 11 comments
trafficstars

image

Hi all, with just a basic installation of cadquery, im getting this issue:

raise AttributeError("module {!r} has no attribute " AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?

my numpy version is 2.0.0, do I need to downgrade it in order to use cadquery?

ghxstweb avatar Jul 12 '24 02:07 ghxstweb

See #1616

jmwright avatar Jul 12 '24 11:07 jmwright

For now, downgrade numpy to 1.23.5 because from 1.24 it's deprecated.

sbalk avatar Aug 21 '24 14:08 sbalk

same problem... please replace all numpy.bool8 with numpy.bool_ ...or avoid NumPy types for booleans

AnonymouZEE avatar Aug 31 '24 13:08 AnonymouZEE

This is fixed in master, see #1617

adam-urbanczyk avatar Sep 01 '24 09:09 adam-urbanczyk

still didnt work for me. had to revert to numpy 1.23.5

YahliGilboa avatar Sep 06 '24 14:09 YahliGilboa

What did not work exactly in master? How did you install it? Which dep gives the error?

adam-urbanczyk avatar Sep 06 '24 17:09 adam-urbanczyk

I can confirm that upgrading to cadquery master fixes this issue for me.

Command I used:

pip install --user -U git+https://github.com/CadQuery/cadquery.git --break-system-packages

with current master revision = 5429f61

ulikoehler avatar Sep 12 '24 00:09 ulikoehler

Neither solution worked for me, I always get "Process finished with exit code -1073741819 (0xC0000005)" error" and I don't know why. I tried clean installation from master in virtual environment with latest pip, but I still get this error.

zakzook333 avatar Sep 13 '24 21:09 zakzook333

@zakzook333 I believe the "Process finished fwith exit code" is a totally different error and I'd guess its opencascade related but not sure. Can you share a full stacktrace?

ulikoehler avatar Sep 13 '24 21:09 ulikoehler

I don't have a full stracktrace. I only put "import cadquery" into the script and it gives me this error. The interesting thing is that when I type "import cadquery" followed by "cadquery.Workplane('XY').box(1,2,3).toSvg()" directly into shell I get raw SVG output as I am supposed to get. But when I tried to run the script with the same code I get that error.

Edit: I tried it on new PC with fresh Python install and it works, so it's unrelated to the lib. Sorry for spam.

zakzook333 avatar Sep 13 '24 21:09 zakzook333

When will this fix be released? it's urgent to me.

joe-cho avatar Oct 17 '24 22:10 joe-cho

AttributeError: 'Editor' object has no attribute 'run_cell_action'

A decent workaround is to run the following. This is assuming you have a dedicated virtual environment for this, if you don't, you are likely to break other things. If you use conda/mamba, I have no idea, since I don't use them

pip install nlopt==2.7.1
pip install numpy==1.23.5
pip install spyder==5

Explanation:

  • the numpy is what is suggested to do by others in this ticket, however that alone is insufficient, because it conflicts with the latest nlopt which is otherwise installed, so we need to downgrade that first
  • such a downgrade is a pain to identify but you can get a list of candidates with pip index versions nlopt. Then by trial and error which each version, go into a browser and try every version starting from https://pypi.org/pypi/nlopt/2.9.0/json and search for the numpy dependency. The newest version that does not require numpy 2 is https://pypi.org/pypi/nlopt/2.7.1/json and that is what I selected
  • With that solved, we are bitten by https://github.com/CadQuery/CQ-editor/issues/455 and the last line solves that

But yes, it would be nice to have such things included in the requirements.txt rather than having to reverse engineering it.

With this, it appears to be working (but I have done only minimal tests so far)

davidedelvento avatar Nov 23 '24 17:11 davidedelvento

This should be fixed now that CadQuery 2.5.2 is available.

jmwright avatar Jan 07 '25 18:01 jmwright