Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

pip/Python modules solution for Sept 2019 update

1 REPLY 1
SOLVED
Reply
Message 1 of 2
lorraine5RWGT
927 Views, 1 Reply

pip/Python modules solution for Sept 2019 update

Problem

----------

In the new update, I couldn't install modules through pip the way that has usually worked for me:

(this is in Fusion's Python interpreter)

 

import pip
pip.main(['install', numpy])

I just get this now:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'pip' has no attribute 'main'

 

Solution

----------

I found some pip exe's in the Scripts folder that Fusion's python.exe is in.

I was able to run pip this way in Windows PowerShell to install, e.g. numpy.

 

> .\pip3 install numpy
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/bd/51/7df1a3858ff0465f760b482514f1292836f8be08d84aba411b48dda72fa9/numpy-1.17.2-cp37-cp37m-win_amd64.whl (12.8MB)
     |████████████████████████████████| 12.8MB 6.4MB/s
Installing collected packages: numpy
  WARNING: The script f2py.exe is installed in 'c:\users\lorraine\appdata\local\autodesk\webdeploy\production\8fc78e02ada35f7bfe8c61944f4c29231b2e06ab\python\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.17.2

Check that it is installed and in the right place:

 

> ./pip3 show numpy
Name: numpy
Version: 1.17.2
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: c:\users\lorraine\appdata\local\autodesk\webdeploy\production\8fc78e02ada35f7bfe8c61944f4c29231b2e06ab\python\lib\site-packages
Requires:
Required-by:
PS C:\Users\lorraine\AppData\Local\Autodesk\webdeploy\production\8fc78e02ada35f7bfe8c61944f4c29231b2e06ab\Python\Scripts>

 

`pip.main` still doesn't work in the Python interpreter, but importing numpy does -- voilà

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>> pip.main
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'pip' has no attribute 'main'
>>> import numpy

 

 

1 REPLY 1
Message 2 of 2

Edit: The pip3.exe probably exists because I ran get-pip.py first (https://bootstrap.pypa.io/get-pip.py)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report