Jump to content

install NUMPY and SCIPY in Vectorworks on an IMAC.


Recommended Posts

This the kind of troubles with VW which solution is a dirty or messy 'workaround'.

 

I did this inside a Python script:

Marionette.VerifyOrGetLib('numpy', 'https://files.pythonhosted.org/packages/e8/bd/937ffc7345985456c963089418c4c7efdb2ca3af36624c5ea60a07d99bcf/numpy-1.25.0-cp311-cp311-macosx_11_0_arm64.whl')

 

To get the url of SciPy you have to go to:

 

https://pypi.org/project/scipy/#files

 

On a MacBook Pro with Ventura running on a M1 chip, installation succeed but then I got and import error:

 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

The Python version is: Python3.9 from "/Applications/Vectorworks 2023/Vectorworks 2023.app/Contents/MacOS/Vectorworks"

The NumPy version is: "1.25.0"

and make sure that they are the versions you expect.

Please carefully study the documentation linked above for further help.

I checked the Python and NumPy versions and are OK.

Edited by Walter Rojas
Link to comment
  • 3 weeks later...
  • 3 months later...

I have numpy working with VW2024 and VW2021 on a M2 macbook pro. A few things that may help.

numpy and other complex packages have compiled libraries usually written in C to extend or speed up python.

These libraries have to be compiled for the hardware and OS they are running on.

 

There is a correct numpy whl file, and there are all the others. Using the correct one (provided it is not corrupt will work)

The others will likely not, depending on how bad the incompatibility is with the libraries.

Using the example posted above https://files.pythonhosted.org/packages/e8/bd/937ffc7345985456c963089418c4c7efdb2ca3af36624c5ea60a07d99bcf/numpy-1.25.0-cp311-cp311-macosx_11_0_arm64.whl'

This is the wrong file: Breaking down numpy-1.25.0-cp311-cp311-macosx_11_0_arm64.whl

numpy-1.25.0            installs numpy version 1.25.0

cp                               C Python

311                             v3.11

-macosx_11_0            mac os 11.0

_arm64.whl                arm64 processors ie M1/M2

 

The above post says:

Installed on a mac with M1 processor

The Python version is: Python3.9 from "/Applications/Vectorworks 2023/Vectorworks 2023.app/Contents/MacOS/Vectorworks"

The NumPy version is: "1.25.0"

 

In this case, numpy-1.25.0-cp39-cp39-macosx_11_0_arm64.whl is the correct file.  (*assuming VW2023 was compiled for ARM and not intel, i don't have it to check)

 

Vectorworks 2021 was compiled for intel processors and runs in Rozetta. The embedded python is also intel and requires an intel _x86_64.whl file

 

Now, it depends on how you install it. 

It should be installed into  /Users/YOURUSERNAME/Library/Application\ Support/Vectorworks/2024/Python\ Externals/

There are a few ways to get it there.

Using either Marionette.VerifyOrGetLib() or the Marionette installer .vwx file above, and selecting the correct .whl file should work.

 

Using something like

 pip install -t /Users/dane/Library/Application\ Support/Vectorworks/2024/Python\ Externals numpy-1.25.0-cp39-cp39-macosx_11_0_arm64.whl

*may* work depending on how you got pip.

If you upgraded your mac form an intel mac and migrated your data you probably have an x86 build of pip.

If that is the case and you try to install a arm.whl you will get an error about compatibility with the system.

pip is running in Rozetta and thinks the Mac is intel

upgrading pip won't help. You need to install it all again. 

 

Conversely, if you have VW2021 (intel) and you have an ARM  version of pip you will get a similar mismatch problem.

 

Using: 

 pip install -t /Users/dane/Library/Application\ Support/Vectorworks/2024/Python\ Externals numpy

will probably not work because it will install the latest version corresponding to the environment it is running in, and the Python version installed on mac os, not the embeded python in vectorworks

 

With VW2021 if you use import .vwx file above, it will install to /Applications/Vectorworks 2021/Vectorworks 2021.app/Contents/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy

This is not a problem, it seems to work ok

 

 

This may help see what is going on

import os
import sys
import platform
import vs
vs.AlertCritical(f"PATH: {os.environ.get('PATH')}\n Python Version {sys.version}"
        +f"\n Platform {platform.machine()}",f"{ sys.path}")
import numpy as np
a=np.array([1,2,3,4])
vs.AlertCritical(f"numpy version {np.__version__}\nnumpy location {np.__file__}",f"result np.array([1,2,3,4]): {a}")

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...