Author Topic: Keyshot 9 doesn't properly detect Python 3.7 install  (Read 1596 times)

0 Members and 1 Guest are viewing this topic.

Keyshot 9 doesn't properly detect Python 3.7 install
« on: November 18, 2019, 12:57:12 am »
We've just switched to Keyshot 9 because we need access to the additional Python APIs that were introduced, like access to studios and multi-materials.
I've noticed that Keyshot 9 doesn't detect Python 3.7 installation properly even if following the steps described in the "Read Me First" topic https://www.keyshot.com/forum/index.php?topic=11474.0.
I wrote a small script to show me some information about Python version and installed modules:
Code: [Select]
import sys

print("Version: " + str(sys.version_info))
print(sys.path)
print(help('modules'))
and I've noticed some interesting differences when ran in Keyshot 8 vs. Keyshot 9. The sys path in Keyshot 9 seems to contain only the "user" location for modules:
Code: [Select]
['C:\\Program Files\\KeyShot9\\bin\\py-modules', 'C:\\Program Files\\KeyShot9\\bin\\py-dist', 'C:\\Users\\Public\\Documents\\KeyShot 9\\Scripts', 'C:\\Users\\moldo\\AppData\\Roaming\\Python\\Python37\\site-packages']vs the sys path in Keyshot 8:
Code: [Select]
['C:\\Program Files\\KeyShot8\\bin\\py-modules', 'C:\\Program Files\\KeyShot8\\bin\\py-dist', 'C:\\Users\\Public\\Documents\\KeyShot 8\\Scripts', 'C:\\python36\\DLLs', 'C:\\python36\\lib', 'C:\\python36', 'C:\\python36\\lib\\site-packages']Because of this all the additional modules that we require in our scripts that we installed with
Code: [Select]
python -m pip install <module name> where not found.
We found a workaround by uninstalling the modules and re-installing them using the "--user" option
Code: [Select]
python -m pip install --user <module name>This fixed import of most of the modules but we still have troubles importing the "logging" module that's part of the Python 3.7 installation but seems to be missing from Keyshot 9's embedded Python.
Adding main site packages path to the sys path (like in Keyshot 8) should solve this issue.

Offline PhilipTh

Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #1 on: November 18, 2019, 06:13:50 am »
Hello heretique,

Thank you for upgrading to KeyShot 9!

Would you be able to provide the full list of locations in your 'Path' system environment variable?

Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #2 on: November 18, 2019, 09:08:26 am »
Yes, here you go:
Code: [Select]
C:\apps\cmder\bin;C:\apps\cmder\vendor\bin;C:\apps\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\apps\cmder\vendor\conemu-maximus5;C:\apps\cmder\vendor\conemu-maximus5\ConEmu;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\apps\ziglang;C:\Program Files\Intel\iCLS Client\;C:\Python37;C:\Python37\Scripts\;C:\VulkanSDK\1.1.82.1\Bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\libnvvp;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\PuTTY\;C:\Program Files\Calibre2\;C:\Imagination\PowerVR_Graphics\PowerVR_Tools\PVRVFrame\Library\Windows_x86_32;c:\apps\cmder;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\apps\vcpkg;c:\apps\ffmpeg\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\apps\apache-maven-3.5.4\bin;C:\Program Files\dotnet\;C:\ProgramData\chocolatey\bin;c:\Program Files\Foundry\Modo\12.1v2;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\apps\Yarn\bin\;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Git\cmd;C:\WorkspaceC\Chesapeake\bin;C:\Program Files\Chesapeake Technology, Inc\SonarWiz7;C:\apps\CMake\bin;C:\apps\OpenNI2\Redist;C:\Program Files\TortoiseSVN\bin;C:\ctidevcommon\PCL 1.8.0\bin;C:\Users\moldo\.cargo\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\PowerShell\6\;C:\apps\nodejs\;C:\apps\Miniconda3\condabin;C:\Users\moldo\AppData\Local\Microsoft\WindowsApps;C:\Users\moldo\AppData\Local\Programs\Microsoft VS Code\bin;C:\apps\CMake\bin;C:\Users\moldo\AppData\Local\hyper\app-2.0.0\resources\bin;C:\Users\moldo\go\bin;C:\tools\dart-sdk\bin;C:\Users\moldo\AppData\Roaming\Pub\Cache\bin;c:\apps\nim-0.19.0\bin;C:\Users\moldo\.nimble\bin;C:\Users\moldo\AppData\Local\Yarn\bin;c:\apps\nim-lang\bin;C:\Users\moldo\AppData\Local\Microsoft\WindowsApps;C:\Users\moldo\AppData\Roaming\npm;C:\apps\SysGCC\raspberry\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\apps\cmder

Offline PhilipTh

Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #3 on: November 20, 2019, 01:01:11 am »
It seems to be finding your roaming installation automatically. Are there 2 installations on your system somehow?

In any case, it seems to be unable to locate your C:/ installation.

What happens if you open a CMD and write 'python --version'? Is it able to find your installation?
« Last Edit: November 20, 2019, 01:09:02 am by PhilipTh »

Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #4 on: November 20, 2019, 06:18:25 am »
My environment is like this:
 - three Python installations 2.7, 3.6 and 3.7 as seen in the attached "python_installs.jpg" image.
 - two Keyshot versions, 8.2 and 9.0

From all three Python installations, only the one in C:\\Python37 is added to path (Note: if I remove it from path, same behavior is observed, nothing changes).
You can also see the version of Python returned by
Code: [Select]
python --version (Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52)) in the other attached image.
I repeat that Keyshot 8.2 properly finds the Pyhton 3.6 installation even it is not added to the path.
Code: [Select]
['C:\\Program Files\\KeyShot8\\bin\\py-modules', 'C:\\Program Files\\KeyShot8\\bin\\py-dist', 'C:\\Users\\Public\\Documents\\KeyShot 8\\Scripts', 'C:\\python36\\DLLs', 'C:\\python36\\lib', 'C:\\python36', 'C:\\python36\\lib\\site-packages']

Offline PhilipTh

Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #5 on: November 22, 2019, 01:19:50 am »
Sorry for the long delay.

I believe to have found the cause of your issue.

It seems you have installed 32-bit Python.
Please note that KeyShot 9 requires 64-bit Python.

Let me know if it still does not work for you.

Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #6 on: November 22, 2019, 01:36:22 am »
Thanks Philip,
I re-installed Python 3.7 64 bit and I can confirm that indeed that was the problem. The "Read Me First" post clearly states that but I already had 3.7 installed and I didn't notice it was 32 bit.
Thanks again for you help in flushing this problem out.
Cheers!

Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #7 on: December 18, 2019, 10:27:33 am »
Hi,
I'm having a similar problem, again, with Keyshot 9 not detecting the Python installation. I created and installer that installs Python to C:\Python37 it installs my required script dependencies and my script to default Keyshot 9 scripts location. When I run it on my machine and one of my colleagues's machine it works fine, Keyshot finds external Python's modules and runs without issues but when we try it on the client's machine it doesn't work. Keyshot doesn't find external Python location.
We've verified that:
 - Keyshot 9 and Python 3.7 are both  64 bit
 - Python is installed to C:\Python37
 - Python is not in the path
 - even if they do all the steps manually as described in the "Readme first post" with the above checked, it still doesn't work
Are there other things Keyshot 9 checks to find a valid Python 3.7 installation? Is the type of the Windows user important (does it need raised privileges)? Anything else we should look for to find what's different in our environments?
Thanks in advance!

Offline Morten Kristensen

  • root
  • Administrator
  • Full Member
  • *****
  • Posts: 142
  • Total likes: 1
  • Software Engineer, Luxion
Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #8 on: December 19, 2019, 11:51:48 pm »
Sorry for the confusion. Python 3.8 is actually for KeyShot 9.1 (early Friday here).
I would suggest that you add your Python bin/ folder to PATH which will help KeyShot looking for it. But it will actually try in C:\Python37 as well.
Which python*.exe files do you have in that folder?

Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #9 on: December 19, 2019, 11:56:13 pm »
There's no bin folder in there, there's pythonw.exe, python.exe, python3.dll, python37.dll and vcruntime140.dll in the C:\Python37 folder on my machine which works. It should be the same on client's machine because we're using the same installer but we will ask just to make sure.
We've also added that folder to Path environment variable but it has no effect.

Offline Morten Kristensen

  • root
  • Administrator
  • Full Member
  • *****
  • Posts: 142
  • Total likes: 1
  • Software Engineer, Luxion
Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #10 on: December 20, 2019, 12:01:18 am »
Okay, that's great. It will try running the following:
Code: [Select]
C:\Python37\python.exe -c "import sys; v = sys.version_info; print(v.major); print(v.minor); print(sys.maxsize > 2**32); print(sys.path)"And check that the first three are [3, 7, True]. It will also wait a maximum of 5 seconds for Python to reply (which is only a problem of faulty installations).

Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #11 on: December 20, 2019, 12:06:00 am »
This is what I get on my machine which works:
Code: [Select]
3
7
True
['', 'C:\\Python37\\python37.zip', 'C:\\Python37\\DLLs', 'C:\\Python37\\lib', 'C:\\Python37', 'C:\\Users\\moldo\\AppData\\Roaming\\Python\\Python37\\site-packages', 'C:\\Python37\\lib\\site-packages']
will ask the client to run this on their machine as well and come back with result.
Is it possible to be also related to license? Just a thought, I mean we have a development license which is unrestricted.

Offline Morten Kristensen

  • root
  • Administrator
  • Full Member
  • *****
  • Posts: 142
  • Total likes: 1
  • Software Engineer, Luxion
Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #12 on: December 20, 2019, 01:55:23 am »
I've added more diagnostic log information for 9.1 when it cannot find a viable, local Python installation. This should help in the future.
It is required to have a Pro license in order to use scripting in KeyShot.

Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #13 on: December 20, 2019, 03:03:37 am »
Here's the output of running that command on client's machine:

Offline Morten Kristensen

  • root
  • Administrator
  • Full Member
  • *****
  • Posts: 142
  • Total likes: 1
  • Software Engineer, Luxion
Re: Keyshot 9 doesn't properly detect Python 3.7 install
« Reply #14 on: December 20, 2019, 03:54:13 am »
That looks fine. Does the client have a KeyShot Pro license?