• Announcements

    • JimW

      The Future of Algorithmic Design   05/23/2017

      Natively available within Vectorworks software, Marionette delivers an algorithmic means to orchestrate and dictate design forms and customizations without needing to be a programmer.   Let the Marionette collaboration begin. Watch this video to learn how you can upload and share Marionette objects, nodes, and networks with your peers.
DomC

PIL (Python Image Library) for VW 2018

5 posts in this topic

Hi

Anyone got the PIL Auto-Library-Installer got to work with 2018?

 

I am testing with this Python-Vectorscript on Mac Sierra:

#Python Script

import Marionette
PillowPath = 'https://pypi.python.org/packages/c0/53/744c1127f0fa988c742f9db6615127125f993da8324e3126b3d769947fc0/Pillow-4.0.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl'
Marionette.VerifyOrGetLib('PIL', PillowPath)

I think maybe this installer package is not for sierra ...

A strange thing happens, if I run the script (Or run it in a Marionette Node, it's the same): My Vectorworks starts a 2nd time while the original Vectorworks freezes

 

All other other tested Packages works fine:

ShapelyPath = 'https://pypi.python.org/packages/83/38/67f9826a0e6ac8e3dbf9207b1e30f6e74f042e8a4ff0a958fb113ef81d12/Shapely-1.6.2.post1-cp35-cp35m-macosx_10_9_intel.macosx_10_9_x86_64.whl#md5=ab1afb53f6ba7f0b26f24e2c8485dced'
matplotlibPath = 'https://pypi.python.org/packages/ca/3a/ed9fdea2d54d5d547ef24d98da5ad4354754e10cbc2e4159a29cb44d0b8a/matplotlib-2.1.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl'

Also Scipy, Numpy

 

Why of all things "Pillow" :-(  Is there any alternative?

 

 

 

Edited by DomC

Share this post


Link to post
Share on other sites

Have you tried python -m pip install pillow? If successfully installed, you can see what version of pillow it tried to install.

 

Share this post


Link to post
Share on other sites

Hi

Thanks for Input. I can install PIL from external python package. Even I can copy/paste PIL 3.0.0 from my 2017 user Folder and it works. I think embedded python version in 2018 is 3.5 ..

 

So far it makes no sense to use external moduls in Marionette nodes  if users have to install them manually. The task is to check and install the module inside the node with the embedded python. I am sure, there are ways to do the installation with a subprocess or by changing something in the Function or by updating something inside the embedded python.

 

An installer routine for external python modules in Marionette nodes is something, which already exists. I tried with some options like '--verbose' (detailed error log) etc. from the PIP Documentation here:

https://pip.pypa.io/en/stable/reference/pip/

 

Could be everything. From a user Error (wrong package, wrong url) over a Bug in PIL,  an Installer Bug to a Vectorworks incompatibility ...

I played around with the Marionette Module checker (With this code as a simple Script it do not crash and I was able to play around with some parameters)

I think I should stop investing my time for that issue. 

 

The Error log:

5a08b64229482_PILinstallationlog.thumb.png.5aea1a96f8e0069973b162870ccfb9d9.png

The most interesting code line:

ret_code = pip.main(['install', appuserfldr + downloadedfile, '--target', cmd ]) 

 

The Module Installer:

 

import vs
from collections import OrderedDict
import operator
import copy
import  os, sys, subprocess, urllib.request, importlib, logging
exit_code = False
appfolder = vs.GetFolderPath(1)
appuserfldr = vs.GetFolderPath(12)
cmd = 'Python Externals'

missngLibURL = 'https://pypi.python.org/packages/c0/53/744c1127f0fa988c742f9db6615127125f993da8324e3126b3d769947fc0/Pillow-4.0.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl'
#missngLibURL = 'https://pypi.python.org/packages/8b/aa/e62f29194562a58f1e1e4158899bb0e33052db824c08e0eb7ea806315b61/Pillow-3.0.0-cp33-cp33m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl'

missingLib = 'PIL'
#https://pip.pypa.io/en/stable/reference/pip/#general-options


if sys.platform == 'win32': 
	cmd = appuserfldr + cmd
elif  sys.platform == 'darwin':
	pos = appfolder.find(':')
	appfolder = appfolder[pos:]
	appfolder = appfolder.replace(':','/')
				
	pos = appuserfldr.find(':')
	appuserfldr = appuserfldr[pos:]
	appuserfldr = appuserfldr.replace(':','/')
	cmd = appuserfldr + cmd
if not os.path.exists(cmd):
	os.makedirs(cmd)
sys.path.append(cmd)
try:	
	try:
		importlib.import_module(missingLib)
		exit_code = True
	except ImportError:
		#show dialog here
		question = 'Python module ' + missingLib + ' is not installed. Would you like to download and install it now?'
		res = vs. AlertQuestion(question,'', 1,'','','','') 
		if res == 1 :
			if sys.platform == 'win32': 
				piploc = 'Python33\Scripts\pip.exe'
				pathpip = 'Python33\Scripts'  
				cdpath = os.path.join(appfolder, pathpip)
				cmdpip = os.path.join(appfolder, piploc)
				wd = os.getcwd()  
				if os.path.exists(cmd) and os.path.exists(cmdpip):
					os.chdir(cdpath)
					ret_code = subprocess.call([cmdpip, 'install', missngLibURL, '-t', cmd ])
					if ret_code > 0:
						vs.AlrtDialog('Module ', missingLib, ' cannot be downloaded.'); 
						exit_code = False
					else:
						exit_code = True
						sys.path.append(cmd)
						os.chdir(wd)
			elif  sys.platform == 'darwin':
				import pip
				import urllib.request
				pos1 = missngLibURL.rfind('/')
				pos2 = missngLibURL.rfind('whl')
				downloadedfile = missngLibURL[pos1+1:pos2]
				downloadedfile = downloadedfile+'whl'
				urllib.request.urlretrieve(missngLibURL, appuserfldr + downloadedfile)
				#vs.Message(str(downloadedfile))
				ret_code = pip.main(['install', appuserfldr + downloadedfile, '--target', cmd ]) 
				# original Line ret_code = pip.main(['install', appuserfldr + downloadedfile, '-q', '--target', cmd ])
				if ret_code > 0:
					vs.AlrtDialog('Module ', missingLib, ' cannot be downloaded.');
					exit_code = False
				else:
					exit_code = True
				sys.path.append(cmd)
		else:
			exit_code = False
except:
	pass	

 

 

 

 

 

 

Share this post


Link to post
Share on other sites
'https://pypi.python.org/packages/13/3e/cb24be6c222138c7d2028502cd2be3b7bec3592456a01c9450bb0f7be641/Pillow-4.2.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl#md5=28c49cafcd80b160494e3628b8148e0d'

 

The above path is the path I have been using for Mac.

My Mac is giving me a hard time right now, but might be worth trying this path instead? Hopefully I can get my computer running well enough to double check.

Share this post


Link to post
Share on other sites
Quote

The above path is the path I have been using for Mac.

 

Negative ... I use Vectorworks 2018 SP1 German Version. Mac OSX 10.12.6. Same issue with the above url.

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now