# Error Installing Python Extensions

**URL:** <https://forum.knime.com/t/error-installing-python-extensions/82904>\
**Category:** KNIME Extensions\
**Tags:** scripting, python, bug\
**Created:** [September 9, 2024, 3:54pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904 "2024-09-09T15:54:50Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![cristianghlt](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/c/8dc957/32.png) [@cristianghlt](https://forum.knime.com/u/cristianghlt)\
**Post date:** [September 9, 2024, 3:54pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/1 "2024-09-09T15:54:50Z")

</div>

Hello all.  
I am trying to install the python extensions to run a script but there is an error installations with this message :  
" An error occurred while installing the items  
session context was:(profile=KNIMEProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Install, operand=null → [R]org.knime.python.giskard.channel.bin.win32.x86\_64 5.3.0.v202406260950, action=org.knime.product.p2.actions.ShellExec).  
ShellExec command exited non-zero exit value:  
Installation of the Python extension failed:  
critical libmamba Download error (35) SSL connect error [[https://conda.anaconda.org/conda-forge/win-64/ca-certificates-2024.7.4-h56e8100\_0.conda](https://conda.anaconda.org/conda-forge/win-64/ca-certificates-2024.7.4-h56e8100_0.conda)]  
schannel: next InitializeSecurityContext failed: SEC\_E\_ILLEGAL\_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed). More detail may be available in the Windows System event log.  
See the files “C:\Program Files\KNIME\plugins\org.knime.python.giskard.channel.bin.win32.x86\_64\_5.3.0.v202406260950\bin\create\_env.out” and “C:\Program Files\KNIME\plugins\org.knime.python.giskard.channel.bin.win32.x86\_64\_5.3.0.v202406260950\bin\create\_env.err” for details.  
Please refer to the documentation at [Create a New Python based KNIME Extension](https://docs.knime.com/latest/pure_python_node_extensions_guide/index.html#installation_troubleshooting).  
If the current system has no or only restricted internet access a special setup for an offline installation is required. See [Create a New Python based KNIME Extension](https://docs.knime.com/latest/pure_python_node_extensions_guide/index.html#_offline_installation). "

---

<div class="post-metadata">

**Author:** ![Xtian](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/x/b487fb/32.png) [@Xtian](https://forum.knime.com/u/Xtian)\
**Post date:** [September 9, 2024, 10:22pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/2 "2024-09-09T22:22:20Z")

</div>

I have checked my preference configuration in Python tab and it is set up to ‘bundle’. I also checked the bundle content and Pandas Lib is included.

Here is the script I am running and going more in details i see that the second line of my script has a ‘not quick fix available’

My Script:

import [knime.scripting.io](http://knime.scripting.io) as knio  
import pandas as pd #here appears the first line error

# Load the input table

df = knio.input\_tables[0].to\_pandas()

# Sort the dataframe by ‘Customer’, ‘Product’, and ‘Date’ in descending order

df = df.sort\_values(by=[‘Customer’, ‘Product’, ‘Date’], ascending=[True, True, False])

# Initialize new columns ‘New\_SI’ and ‘New\_SO’ with the original ‘SI’ and ‘SO’ values

df[‘New\_SI’] = df[‘SI’]  
df[‘New\_SO’] = df[‘SO’]

# Function to process each group

def process\_group(group):  
# Find indices where there are 3 consecutive zeros in ‘SI’  
zero\_indices = group.index[group[‘SI’] == 0].tolist()  
for i in range(len(zero\_indices) - 2):  
if zero\_indices[i+1] == zero\_indices[i] + 1 and zero\_indices[i+2] == zero\_indices[i] + 2:  
# Set all previous ‘New\_SI’ values to zero  
group.loc[:zero\_indices[i], ‘New\_SI’] = 0  
break

```
# Find indices where there are 3 consecutive zeros in 'SO'
zero_indices = group.index[group['SO'] == 0].tolist()
for i in range(len(zero_indices) - 2):
    if zero_indices[i+1] == zero_indices[i] + 1 and zero_indices[i+2] == zero_indices[i] + 2:
        # Set all previous 'New_SO' values to zero
        group.loc[:zero_indices[i], 'New_SO'] = 0
        break

return group

```

# Apply the function to each group of ‘Customer’ and ‘Product’

df = df.groupby([‘Customer’, ‘Product’]).apply(process\_group)

# Sort the dataframe back to the original order

df = df.sort\_values(by=[‘Customer’, ‘Product’, ‘Date’], ascending=[True, True, True])

# Output the result

knio.output\_tables[0] = knio.Table.from\_pandas(df)

---

<div class="post-metadata">

**Author:** ![Xtian](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/x/b487fb/32.png) [@Xtian](https://forum.knime.com/u/Xtian)\
**Post date:** [September 10, 2024, 1:37am UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/3 "2024-09-10T01:37:03Z")

</div>

I continue to investigate and have identified that although my ‘python setup’ is using the bundle mode, the pandas lib is failing to execute.

 ![Knime-Pandas](https://forum-cdn.knime.com/uploads/default/original/3X/1/e/1e0526065ccda442a6a8d9f5f59efba6f31c82d7.png)

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [September 10, 2024, 3:54am UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/4 "2024-09-10T03:54:30Z")

</div>

@Xtian you could try and do a fresh installation. Then you could provide us with a clean log in debug mode:

1. Set logging level to debug in the preferences

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/4/3/431ccfcd8e7d0161278a7182d4e8b0b5fe28a0f0.jpeg)

1. find the location of the log file

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/6/2/62d7e4221402f885b93fa5d9da67487f8e03d60c.png)

1. Delete or rename the existing log (you might have to close KNIME first and store the path to find the log)

![image](https://forum-cdn.knime.com/uploads/default/original/3X/0/4/04255e9876f39cad22c53e1d2446e7c188ba1226.png)

1. Restart KNIME and do the operation that causes the problem

2. find the Log again and zip it and send it to support or post it in the forum

3. Reset your log level to WARN (or whatever you prefer)

* * *

If you present code in the forum it would be great to have it in a readable format or as an attachment

> [@Dynamic Filter connected to several Python Views of a dashboard](https://forum.knime.com/t/dynamic-filter-connected-to-several-python-views-of-a-dashboard/75456/8):
>
> @DanGenEire what would be good is a complete workflow example and a code that is formatted in a readable way or add it as a file. [image] import pandas as pd import numpy as np I will see if I can come up with an example later.

---

<div class="post-metadata">

**Author:** ![steffen\_KNIME](https://forum-cdn.knime.com/user_avatar/forum.knime.com/steffen_knime/32/33719_2.png) [@steffen\_KNIME](https://forum.knime.com/u/steffen_KNIME)\
**Post date:** [September 10, 2024, 9:38am UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/5 "2024-09-10T09:38:45Z")

</div>

Hi @cristianghlt,

the error message gives detailed hints of where to start investigating, did you follow them?

Best regards  
Steffen

---

<div class="post-metadata">

**Author:** ![Xtian](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/x/b487fb/32.png) [@Xtian](https://forum.knime.com/u/Xtian)\
**Post date:** [September 10, 2024, 7:17pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/6 "2024-09-10T19:17:25Z")

</div>

Thanks, I have no technical background but I will follow all your suggestions. Let me check.

---

<div class="post-metadata">

**Author:** ![Xtian](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/x/b487fb/32.png) [@Xtian](https://forum.knime.com/u/Xtian)\
**Post date:** [September 11, 2024, 6:22pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/7 "2024-09-11T18:22:52Z")

</div>

Hello all again

Partial positive news. I made a fresh reinstallation of Knime and Python Extensions were installed without errors.

Next step for complete solution will be to run again the Python Script Node with the Bundle Configuration since I am using simple ‘pandas lib’ in my Python Script.

I’ll be back

Thanks

---

<div class="post-metadata">

**Author:** ![Xtian](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/x/b487fb/32.png) [@Xtian](https://forum.knime.com/u/Xtian)\
**Post date:** [September 11, 2024, 7:50pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/8 "2024-09-11T19:50:00Z")

</div>

Hello  
Here is the first failed test with Python Bundled Option. Attached you will find the documentation  
[Testing Python Script with Python Bundled Option.pdf](https://forum.knime.com/uploads/short-url/n2klUnUZkx7Qsna9mLO8XV8pjvl.pdf) (799.9 KB)  
[knime.log](https://forum.knime.com/uploads/short-url/hBkAQTduz8GNPMvi1N4cawcfbst.log) (1.0 MB)  
[Python Script.txt](https://forum.knime.com/uploads/short-url/hCg9UJeUFM9gUEeKXc73m2WOnGb.txt) (1.6 KB)

I will the test the Conda option as well

Regards

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [September 11, 2024, 8:40pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/9 "2024-09-11T20:40:39Z")

</div>

@Xtian I suspect a problem with indexes. Maybe reset them at some point or ask ChatGPT for advice

---

<div class="post-metadata">

**Author:** ![Xtian](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/x/b487fb/32.png) [@Xtian](https://forum.knime.com/u/Xtian)\
**Post date:** [September 12, 2024, 1:21pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/10 "2024-09-12T13:21:46Z")

</div>

Hello @mlauber71 . I tested this script in Jupyter Notebook and is working fine.  
I will continue to check why is not running in Knime environment

Thanks

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [September 12, 2024, 2:04pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/11 "2024-09-12T14:04:07Z")

</div>

@Xtian in the past KNIME sometimes had problems with Python / Pandas indices when bringing them back from the Python world. So maybe you can rest the index right before bringing back the dataframe to KNIME.

---

<div class="post-metadata">

**Author:** ![bwilhelm](https://forum-cdn.knime.com/user_avatar/forum.knime.com/bwilhelm/32/444_2.png) [@bwilhelm](https://forum.knime.com/u/bwilhelm)\
**Post date:** [September 13, 2024, 8:10am UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/12 "2024-09-13T08:10:08Z")

</div>

Hi @Xtian,

Thank you for your detailed report! It appears that the issue is not related to the bundled environment.

The warning on the line “`import pandas as pd`” (in step (5) of your slides) indicates that pandas has been imported but not used. This warning should appear when hovering over the relevant line.

You’ve also uncovered a bug with our Python integration. When we pass data from the KNIME table to a Python script, we use custom Pandas extension arrays to prevent information loss in the columns. However, the current implementation of the extension array is missing the “`_from_factorized`” method, which is required when sorting a table by multiple keys. I’ve created a ticket (AP-23311) to address this issue.

In the meantime, you can work around this by converting the “Date” column to a native Pandas datetime array before sorting, as shown below:

```python
# Convert the extension array to a native Pandas datetime array
df['Date'] = pd.to_datetime(df['Date'])

```

---

<div class="post-metadata">

**Author:** ![Xtian](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/x/b487fb/32.png) [@Xtian](https://forum.knime.com/u/Xtian)\
**Post date:** [September 13, 2024, 4:19pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/13 "2024-09-13T16:19:59Z")

</div>

Thanks @bwilhelm !! It worked perfectly!

Thanks again!

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [September 20, 2024, 4:20pm UTC](https://forum.knime.com/t/error-installing-python-extensions/82904/14 "2024-09-20T16:20:58Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
