WebTools error Python "No module named `requests`"

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
futu_ricks
Posts: 2
Joined: Sun Aug 07, 2022 4:02 pm

WebTools error Python "No module named `requests`"

Post by futu_ricks »

Hi, I have a freshly installed FreeCAD Flatpak on Fedora 36 and freshly installed WebTools workbench. When I switch to WebTools workbench I get an error "No module named `requests`". I do have requests installed on my system with dnf although I'm not sure if that is relevant or if it's supposed to be installed in the bundled Python interpreter or bundled in the addon itself. I'm new to FreeCAD and not sure how these things work.
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: WebTools error Python "No module named `requests`"

Post by mario52 »

Hi

try :

Code: Select all

import WebGui
import urllib
from urllib import request
contentPage = request.urlopen(u"https://wiki.freecadweb.org/Macro_Rotate_View").readlines()
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
futu_ricks
Posts: 2
Joined: Sun Aug 07, 2022 4:02 pm

Re: WebTools error Python "No module named `requests`"

Post by futu_ricks »

Code: Select all

Traceback (most recent call last):
  File "<input>", line 1, in <module>
ImportError: cannot import name 'requests' from 'urllib' (/usr/lib/python3.9/urllib/__init__.py)
After

Code: Select all

from urllib import requests
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: WebTools error Python "No module named `requests`"

Post by mario52 »

Hi

run with

Code: Select all

OS: Windows 10 (10.0)
Word size of FreeCAD: 64-bit
Version: 0.21.29485 (Git)
Build type: Release
Branch: master
Hash: a236ca843fdd6674afb6d7ed1454fbd3b547f5ea
Python 3.8.13, Qt 5.12.9, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.3
try install https://pypi.org/project/requests/

but i don't remember if i have installed it or if it is part of freecad ??

i use it in my macro Macro_FCInfo for detect the version

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: WebTools error Python "No module named `requests`"

Post by adrianinsaval »

installing pip packages for flatpak is not trivial, see: https://github.com/flathub/org.freecadw ... /issues/88
so for now I recommend using and rpm version of FreeCAD, I believe there is a COPR repo with current builds available
Post Reply