Jump to content
Paolo

Installing module in Vectorworks 2021 pip warning (at least on MacOS)

Recommended Posts

Hello python experts,

I am trying to install the Pillow module (on MacOS, Vectorworks 2021) using the function Marionette.VerifyOrGetLib() as from the following script:

PIL = 'https://files.pythonhosted.org/packages/53/7d/c0db10e5f990905aa4bc4f8166414d8a30fb766c1624ced9fe9a43a211d9/Pillow-7.2.0-cp38-cp38-macosx_10_10_x86_64.whl'
import Marionette
    
if Marionette.VerifyOrGetLib('PIL', PIL):
    #vs.Message(PIL)
    from PIL import Image, ImageChops
    

This worked in Vectorworks 2020, now I am getting this annoying script error / warning:

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Warning: You are using pip version 20.1.1; however, version 20.2.3 is available.
You should consider upgrading …

Though the library is correctly installed, is there a way to avoid this error / warning?

 

 

I have examined the VerifyOrGetLib() function (on MacOS is inside /Applications/Vectorworks 2021 IT/Plug-in/Marionette.vwlibrary/Contents/Resources/Marionette.vwr/Scripts/Marionette.py)

As far as I know (I am not a python expert), while on PC this function uses the Vectorworks pip installation, on MacOS, it seems to use the provided system pip that is different (hence the version warning). I do not know the old script wrapper warning means.

 

@tbexon and @K.Lalkovski, any suggestion?

 

Here's the relevant part of the function VerifyOrGetLib() :

 

                  if sys.platform == 'win32': 
					piploc = 'Python38\Scripts\pip3.exe'
					pathpip = 'Python38\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', missingLibURL, '-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)
							vs.AlrtDialog('Module ', missingLib, ' has been successfully installed.')
				elif  sys.platform == 'darwin':
					import pip
					import shlex
					pos1 = missingLibURL.rfind('/')
					pos2 = missingLibURL.rfind('whl')
					downloadedfile = missingLibURL[pos1+1:pos2] +'whl'
					destination = appuserfldr + downloadedfile
					command_line = "curl -o " + '\"' + destination + '\"' + "  "+ missingLibURL
					args = shlex.split(command_line)
					ret_code = subprocess.call(args)
					if ret_code == 0:
						sys_executable_orig = sys.executable
						sys.executable = '/usr/bin/python'
						ret_code = pip.main(['install', destination,'-q','--target', cmd])
						sys.executable = sys_executable_orig
						if ret_code > 0:
							vs.AlrtDialog('Module ', missingLib, ' cannot be installed.')
							exit_code = False
						else:
							vs.AlrtDialog('Module ', missingLib, ' has been successfully installed.')
							exit_code = True
					else:
						vs.AlrtDialog('Module ', missingLib, ' cannot be installed.')
						exit_code = False
					sys.path.append(cmd+'/')

 

Share this post


Link to post

@Paolo  It is a warning, not an error. The pip module is part of the current  python distribution with Vectorworks, both on PC and Mac. The distribution is embedded into the Vectorworks application bundle on Mac. On Win it is just a folder on the disk. On Mac, the pip module cannot be directly accessed as this can be done on PC. This line of code is used to access the embedded pip on Mac   ret_code = pip.main(['install', destination,'-q','--target', cmd])  and it is the reason for the warning. In the next version of VerifyOrGetLib,  I'll  fix the line in order to remove that warning.

  • Like 2

Share this post


Link to post

Hello @K.Lalkovski ,

I am still getting the same warning trying to install Pillow module (you said should have been fixed…).

The module is correctly installed, but this warning is presented as a script error and users of my PlumBob plugin gets disoriented.

I am running Vectorworks 2021 R1 (Build 563191) on MacOS 10.14.6.879439704_Schermata2021-01-05alle08_42_43.thumb.png.76aeb84ba379044daa1e09b79600d433.png

Share this post


Link to post

 

38 minutes ago, Paolo said:

Hello @K.Lalkovski ,

I am still getting the same warning trying to install Pillow module (you said should have been fixed…).

The module is correctly installed, but this warning is presented as a script error and users of my PlumBob plugin gets disoriented.

I am running Vectorworks 2021 R1 (Build 563191) on MacOS 10.14.6.879439704_Schermata2021-01-05alle08_42_43.thumb.png.76aeb84ba379044daa1e09b79600d433.png

Hello @Paolo

I have been working on this issue when I have a good result  I'll let you know.

Share this post


Link to post
16 minutes ago, K.Lalkovski said:

 

Hello @Paolo

I have been working on this issue when I have a good result  I'll let you know.

Thank you

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...