Hi folks,
I have been trying to follow along with the suggestions in this thread, but I am still in a bit of a mess here.
I have been using numpy and scipy in cpython 3 in gh which has been working fine until I mistakenly accepted the rhino 8.8 update on my return from holiday yesterday! I spent yesterday trying to solve this and have just updated to RC 8.9 in the hope that this would magically go away, to no avail! I’m a bit stressed as I need to use the scripts I had worked on before my holidays to produce output for a deadline next week - great way to come back from the holidays!!
So I am running Version 8 SR9 (8.9.24171.3001, 2024-06-19)
Here is the code I’ve been running to try and verify numpy and scipy:
"""Grasshopper Script"""
#! python 3
# venv: site-packages
# r: numpy
# r: scipy
# r: networkx
__author__ = "Brian"
__version__ = "2024.06.22"
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino.Geometry as rg
import ghpythonlib.treehelpers as th
import csv
import os
import math
import scipy as sp
import numpy as np
import networkx as nx
#import scipy.stats as spst
numpy_version = np.__version__
scipy_version = sp.__version__
print(f"numpy version is {numpy_version}\n")
print(f"scipy version is {scipy_version}\n")
dist = sp.stats.norm()
output:
numpy version is 2.0.0
scipy version is 1.13.1
Traceback (most recent call last):
File "rhinocode:///grasshopper/1/3f34b412-d348-41b4-a514-a5443794ff16/bd5293a5-7390-4539-9d9c-4c83d0c842c8", line 31, in <module>
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\scipy\__init__.py", line 162, in __getattr__
return _importlib.import_module(f'scipy.{name}')
File "C:\Users\brian\.rhinocode\py39-rh8\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\scipy\stats\__init__.py", line 606, in <module>
from ._stats_py import *
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\scipy\stats\_stats_py.py", line 37, in <module>
from scipy import sparse
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\scipy\sparse\__init__.py", line 294, in <module>
from ._base import *
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\scipy\sparse\_base.py", line 5, in <module>
from scipy._lib._util import VisibleDeprecationWarning
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\scipy\_lib\_util.py", line 18, in <module>
from scipy._lib._array_api import array_namespace
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\scipy\_lib\_array_api.py", line 17, in <module>
from scipy._lib.array_api_compat import (
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\scipy\_lib\array_api_compat\numpy\__init__.py", line 1, in <module>
from numpy import *
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\numpy\f2py\__init__.py", line 19, in <module>
from . import f2py2e
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\numpy\f2py\f2py2e.py", line 23, in <module>
from . import crackfortran
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\numpy\f2py\crackfortran.py", line 159, in <module>
from .auxfuncs import *
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\numpy\f2py\auxfuncs.py", line 19, in <module>
from . import cfuncs
File "C:\Users\brian\.rhinocode\py39-rh8\lib\site-packages\numpy\f2py\cfuncs.py", line 19, in <module>
errmess = sys.stderr.write
AttributeError: 'NoneType' object has no attribute 'write'
Any advice gratefully received!