Keyshot 9 doesn't properly detect Python 3.7 install

Started by Catalin Moldovan, November 18, 2019, 12:57:12 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Catalin Moldovan

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:

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:
['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:
['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 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 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.

PhilipTh

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?

Catalin Moldovan

Yes, here you go:
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

PhilipTh

#3
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?

Catalin Moldovan

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 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.
['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']

PhilipTh

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.

Catalin Moldovan

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!

Catalin Moldovan

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!

Morten Kristensen

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?

Catalin Moldovan

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.

Morten Kristensen

Okay, that's great. It will try running the following:
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).

Catalin Moldovan

This is what I get on my machine which works:
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.

Morten Kristensen

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.

Catalin Moldovan

Here's the output of running that command on client's machine:

Morten Kristensen

That looks fine. Does the client have a KeyShot Pro license?