Jump to content

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


Paolo

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+'/')

 

Link to comment
  • Vectorworks, Inc Employee

@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
Link to comment
  • 2 months later...
  • Vectorworks, Inc Employee

 

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.

Link to comment
  • 9 months later...
  • 1 month later...

Hello @K.Lalkovski,

here we are again… still the

Marionette.VerifyOrGetLib()

does not work on Windows, Vectorworks 2022, importing Pillow module.

Here below the code I am using, with the appropriate wheel files. It works on macs (arm or x86), but does not install nothing on Windows.

Previously, with Vectorworks 2021, it worked…

Can you address me (us) to a fix, even creating a temporary alternative function to the VerifyOrGetLib()?

 

Also I am still getting the same warning (see post dated january 5 in this same thread) after the (correct) module installation on mac.

 

import platform
import Marionette 
arm64 = ('arm64' in platform.machine())
(major, minor, maintenance, platform, buildNum) = vs.GetVersionEx()
#vectorworks 2022 has python 3.9.2
if platform == 2:
    PIL = 'https://files.pythonhosted.org/packages/20/ec/15a263f2c65d71cf62aa767f774c2381077e07beb1e9309a94461ec1cd29/Pillow-8.4.0-cp39-cp39-win_amd64.whl'
    
else:
    PIL = 'https://files.pythonhosted.org/packages/32/25/32889d2b7c577b5a454dd12194b2ecb9d87d4b49c15c278dc99bc8ff5d2e/Pillow-8.4.0-cp39-cp39-macosx_10_10_x86_64.whl'
    
    #for mac M1
    if arm64:
        PIL = 'https://files.pythonhosted.org/packages/7d/88/a59b397f030e131accd4ca5a2ad7f1ac62347e6f4aadbe3dabd329aaded9/Pillow-8.4.0-cp39-cp39-macosx_11_0_arm64.whl'
result = Marionette.VerifyOrGetLib('PIL', PIL)
if result:
    vs.AlrtDialog('PIL module is correctly installed:\n', PIL)
else: #PIL not installed
    vs.AlertCritical('Attention!','It has been not possible to install the PIL module.')

cc: @tbexon, @DomC

 

Link to comment
  • Vectorworks, Inc Employee
13 hours ago, Paolo said:

Hello @K.Lalkovski,

here we are again… still the

Marionette.VerifyOrGetLib()

does not work on Windows, Vectorworks 2022, importing Pillow module.

Here below the code I am using, with the appropriate wheel files. It works on macs (arm or x86), but does not install nothing on Windows.

Previously, with Vectorworks 2021, it worked…

Can you address me (us) to a fix, even creating a temporary alternative function to the VerifyOrGetLib()?

 

Also I am still getting the same warning (see post dated january 5 in this same thread) after the (correct) module installation on mac.

 

import platform
import Marionette 
arm64 = ('arm64' in platform.machine())
(major, minor, maintenance, platform, buildNum) = vs.GetVersionEx()
#vectorworks 2022 has python 3.9.2
if platform == 2:
    PIL = 'https://files.pythonhosted.org/packages/20/ec/15a263f2c65d71cf62aa767f774c2381077e07beb1e9309a94461ec1cd29/Pillow-8.4.0-cp39-cp39-win_amd64.whl'
    
else:
    PIL = 'https://files.pythonhosted.org/packages/32/25/32889d2b7c577b5a454dd12194b2ecb9d87d4b49c15c278dc99bc8ff5d2e/Pillow-8.4.0-cp39-cp39-macosx_10_10_x86_64.whl'
    
    #for mac M1
    if arm64:
        PIL = 'https://files.pythonhosted.org/packages/7d/88/a59b397f030e131accd4ca5a2ad7f1ac62347e6f4aadbe3dabd329aaded9/Pillow-8.4.0-cp39-cp39-macosx_11_0_arm64.whl'
result = Marionette.VerifyOrGetLib('PIL', PIL)
if result:
    vs.AlrtDialog('PIL module is correctly installed:\n', PIL)
else: #PIL not installed
    vs.AlertCritical('Attention!','It has been not possible to install the PIL module.')

cc: @tbexon, @DomC

 

Hi @Paolo,

Let me check and I'll get back to you later today.

  • Like 1
Link to comment
  • Vectorworks, Inc Employee

Hi @Paolo,

Please, take a look at the attached video. What is the number of the Autobuild 2022  you are testing on windows? Give me also details of your system configuration(windows version, processor). The warning on Mac will be  removed in 2022 SP3. Could you prepare a video file for me to see what exactly happens  on your machine?

 

Link to comment

It’s not my PC (I am on mac), they gave me these details, hope it’s enough.

 

The build is

SP1 2022[27.0.1(619242)]

 

The PC is:

Windows

Intel64 Family 6 Model 158 Stepping 12, GenuineIntel

Windows-10-10.0.22000-SP0

AMD64

10.0.22000

uname_result(system='Windows', node='Asus-ROG-Stix-Z390E', release='10', version='10.0.22000', machine='AMD64')

 

the reported error is the following (issued by the VerifyOrGetLib() function)

image.png.473fa8aabee497138f885da01e5a6da6.png

 

And after that it comes the alert in my script

image.png.86bdb63c4cb394b0eafd6df8ddab8c08.png

Link to comment
  • Vectorworks, Inc Employee

Hi @Paolo,

There are two approaches to resolve the problem:

First approach: Replace VW2022 SP1(619242) with the new VW 2022 SP2(622317) .

Second, if you prefer to deal with the existing VW2022 SP1(619242)

Please, find the attached file scripts.zip.

On the problematic PC:
1. Go to <VW App folder>\Python39\Scripts

2.Delete the contents of this folder.

3.Unzip the contents of the scripts.zip file

4.Run VW and try to install PIL.

You should be able to install the Pillow package and any other package.

Let me know if this works for you!

Scripts.zip

  • Like 2
Link to comment

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.

×
×
  • Create New...