Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cmprsk python package example notebook doesn't work

I'm using Python 3.11.1. I've installed https://github.com/OmriTreidel/cmprsk (1.0.0, the latest version) on a new virtual environment, I've installed rpy2 3.4.5 like the documentation suggested, I'm using R 4.2.2 and I've installed the cmprsk package as suggested.

When I run the example notebook provided in the GitHub, I have ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (6,) + inhomogeneous part.

  • Processor: AMD Ryzen 7 5800H with Radeon Graphics
  • Windows 11 Home
  • I'm not using WSL
like image 406
FluidMechanics Potential Flows Avatar asked Aug 16 '26 22:08

FluidMechanics Potential Flows


1 Answers

Introduction

So, I have set up a demo machine, and everything is working. Why? Well, it looks like the cmprsk code base was kindly updated by OmriTreidel (A fine fellow), between when you found the problem and my testing below. The git-repo was updated in the last three days.

See fix the VisibleDeprecationWarning #8 the edit relates to the line referenced fix the VisibleDeprecationWarning #8 files - so it appears the issue is resolved.

To that end, here are the setup details and the python requirements.txt file that I used.

Feel free to try this and see if everything works, it works for me. Hoping this helps point you in the right direction.

Config

    (venv) PS Z:\stackoverflow\75582335> systeminfo
    
    Host Name:                 STACKOVERFLOW
    OS Name:                   Microsoft Windows 11 Pro
    OS Version:                10.0.22000 N/A Build 22000
    OS Manufacturer:           Microsoft Corporation
    OS Configuration:          Standalone Workstation
    OS Build Type:             Multiprocessor Free
    Registered Owner:          Windows User
    Registered Organization:
    ...
    Windows Directory:         C:\Windows
    System Directory:          C:\Windows\system32
    Boot Device:               \Device\HarddiskVolume1
    System Locale:             en-us;English (United States)
    Input Locale:              en-us;English (United States)
    Time Zone:                 (UTC-08:00) Pacific Time (US & Canada)
    Total Physical Memory:     16,095 MB
    Available Physical Memory: 7,429 MB
    Virtual Memory: Max Size:  19,039 MB
    Virtual Memory: Available: 6,647 MB
    Virtual Memory: In Use:    12,392 MB
    Page File Location(s):     C:\pagefile.sys
    ...
    Network Card(s):           2 NIC(s) Installed.
                               [01]: Intel(R) 82574L Gigabit Network Connection
                                     Connection Name: Ethernet0
                                     DHCP Enabled:    Yes

Setup:

Open a PowerShell terminal... alt-shift - # Create a split window (top / bottom) alt-shift + # create a split window (left right)

thus:

enter image description here


> mkdir Z:\stackoverflow\75582335
> cd Z:\stackoverflow\75582335
> winget install GitHub.cli
> winget install RProject.R
> winget install Rstudio
> winget install -e --id Python.Python.3.11 -v 3.11.1
> & 'C:\Program Files\R\R*\bin\x64\RScript.exe' -e "install.packages('cmprsk', repos = 'http://cran.us.r-project.org', dependencies=TRUE)"
R
# Check it installed
> & 'C:\Program Files\R\R*\bin\x64\RScript.exe' -e "require('cmprsk');sessionInfo()"
> pip install virtualenv
> virtualenv venv2 --python=python3.11
> # Activate env2
> .\venv2\Scripts\activate.ps1
> gh repo clone OmriTreidel/cmprsk
> wget https://gist.github.com/Technophobe01/953cceae93e92157f0cc451c4db4ee61#file-requirements-txt 
> pip install -r requirements.txt

ok, move to another window...

> cd Z:\stackoverflow\75582335
> .\venv2\Scripts\activate.ps1
> cd cmprsk
> jupyter-lab

ok, now the browser should open...

enter image description here

Run notebook...

Now we load 'package_usage.ipynb', and run it...

enter image description here

like image 92
Technophobe01 Avatar answered Aug 18 '26 10:08

Technophobe01



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!