I installed Microclimate locally (on macOS) and tried a simple webscraping app. The Microclimate Build was successful but I got a runtime error
k (most recent call last):
File "app.py", line 4, in <module>
from bs4 import BeautifulSoup as mySoup
ImportError: No module named 'bs4'
Seems I need to install a module, how would I do this?
Also, what Python version is being used?
Microclimate runs your application inside a docker container built using the Dockerfile in the root of your project.
If you created your project from the standard Python template you'll already have a line beginning:
RUN pip install
just add BeautifulSoup4 to the list of modules being installed there and microclimate should rebuild and start your app.
Also the level of python used is defined at the top of that dockerfile. In the default template it is currently Python 3.7
Related
Hi I'm a Python newbie trying to program python using pymesh library but I cant get it to install properly.
Accordijng to attached image I have installed it, and the package says its for 3.8.x and I have python 3.8.2 installed.
pymesh installation instructions (https://pymesh.readthedocs.io/en/latest/installation.html) say to run a test after installing the package. The test fails.
(work) (base) D:\Downloads\HoleCutter>python -c "import pymesh; pymesh.test()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: module 'pymesh' has no attribute 'test'
I dont have the resources/capability to 'build packages with cmake'
screen snap from command prompt window
The reason is the PyMesh library isn't kept up to date on PIP, instead you have to use Docker or compile it yourself. This problem is covered by the following issue on Github, however no action has been taken for years: https://github.com/PyMesh/PyMesh/issues/94
Have you tried "pip install pymesh" or "pipx.x install pymesh"?
I think the instructions in the link you provided are for Linux and Mac OS. You can look at this link: ImportError: No module named PyMesh
I have 2 python tools that I have to run via the windows cmd line. One is written in python2.7 while the other requires python3.6.
I have installed the newest Anaconda python3.7 version and created two new environments in 'C:\ProgramData\Anaconda3\envs' called 'python27' and 'python36'. For some reason I had to manually install numpy and scipy using conda install -n env_name numpy scipy for each of the new environments.
The reason I have to run both tools using the windows cmd line is that I have integrated them into a workflow environment (RCE by the DLR in case this is relevant), which executes integrated tools in this way. Which means I cannot simply use the Anaconda Prompt instead.
I cannot simply add the python installation to the PATH environment variable because of each tool requiring a different python version (and the file being called 'python.exe' in all versions), so I tried to create aliases for the cmd prompt as suggested by "roryhewitt" in this thread Aliases in Windows command prompt.
my 'python27.bat' file:
#echo off
echo.
C:\ProgramData\Anaconda3\envs\python27\python.exe %*
The problem with this approach is that python encounters an error when trying to import numpy:
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ProgramData\Anaconda3\envs\python27\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\ProgramData\Anaconda3\envs\python27\lib\site-packages\numpy\core\__init__.py", line 71, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
1. Check that you are using the Python you expect (you're using C:\ProgramData\Anaconda3\envs\python27\python.exe),
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy versions you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.
Does anyone know a better way to run python scripts with a specific python environment via the windows cmd line, or what is causing the import error when I use the alias?
TLDR: I have 2 python tools that require python2.7 and python3.6 respectively. I have to run these tools using the windows cmd line and using aliases to the 'python.exe' file in the specific anaconda environments results in an import error of numpy. Is there a better way to handle two python environments via the cmd line or an easy fix for the import error?
It seems that the ImportError when using python2.7 via the alias in the cmd line was due to the anaconda environment not being activated. This caused the module to be unable to load properly.
I have added the conda functionality to be used in the cmd line as instructed in the post by "Simba" here: Conda command is not recognized on Windows 10. This has fixed the numpy ImportError.
I can now execute the desired tools from the cmd line using the correct python version by activating the correct anaconda environment first, and then calling the alias
Example:
C:\Users\user>conda activate python27
(python27) C:\Users\user>python27 main.py
I have recently started using Python and have installed version 3.7.3 on my Windows 10 machine running as administrator. I then ran the following command in a command prompt to install the xmpppy package
python -m pip install xmpppy
Next I created the following base.py file that uses the aforementioned xmpppy package
#!/usr/bin/env python
import xmpp
user="user"
password="pword"
server="server"
jid = xmpp.JID(user)
connection = xmpp.Client(server,debug=[])
connection.connect()
result = connection.auth(jid.getNode(), password,"LFY-client")
connection.sendInitPresence()
while connection.Process(1):
pass
Now when I run the command
python base.py
in the folder that the base.py file exists I get the following error message:
Traceback (most recent call last):
File "base.py", line 3, in <module>
import xmpp
File "C:\Users\AGO109\AppData\Local\Programs\Python\Python37\lib\site-packages\xmpp\__init__.py", line 29, in <module>
import simplexml,protocol,debug,auth,transports,roster,dispatcher,features,browser,filetransfer,commands
ModuleNotFoundError: No module named 'simplexml'
In the folder C:\Users\AGO109\AppData\Local\Programs\Python\Python37\lib\site-packages\xmpp simplexml.py, protocol.py etc. all exist and the windows system variables contain the paths for python and packages, so what's the problem?
I'm facing same issue.
Try installing each of the packages using command like pip install simplexml and then run your code. Mine is stuck at installing transports.
Alternately,you may try switching to using sleekxmpp that comes bundled with your python installation. As sleekxmpp has latest version published in 2017 compared to that of 2006 for xmpppy, i'm planning to stick with using sleekxmpp library. If you update your code to use sleekxmpp as per the boilerplate code at https://pypi.org/project/sleekxmpp/, XMPP connections work.
I am following the smartsheet API's python-sdk example to do some practice.
Below are my steps (using Python 3.4.4 on macOS 10.7.5):
installed the SDK package from their GitHub repo
installed pip using pip install smartsheet-python-sdk in my terminal
created a .py file and moved it into the SDK file
Issue
When I run it, I got following error message:
Traceback (most recent call last):
File "/Users/canny_aiyaya/Desktop/smartsheet-python-sdk-master/smartsheet/charity.py", line 5, in <module>
import smartsheet
File "/Users/canny_aiyaya/Desktop/smartsheet-python-sdk-master/smartsheet/smartsheet.py", line 28, in <module>
import requests
ImportError: No module named 'requests'
Code in the .py file
import smartsheet
ss_client = smartsheet.Smartsheet(access_token)
ss_client.errors_as_exceptions(True)
Analysis
I looked for some possible solutions, and try to install requests on my terminal using sudo pip3 install requests, but it shows:
No matching distribution found for requests
This is my first time trying to use API on Smartsheet, any supports/links/videos will very helpful.
There are a number of dependencies. You can run python setup.py install from the Smartsheet SDK directory to install them.
This question has been asked a few times, but the remedy appears to complicated enough that I'm still searching for a user specific solution.
I recently installed Quandl module using pip command. Even after successful installation my python idle is still showing
Traceback (most recent call last):
File "F:\Python36\Machine Learning\01.py", line 3, in <module>
import Quandl
ModuleNotFoundError: No module named 'Quandl'
I have used import command in my code.
I am using python 3.6.1 version.
I am working on a windows 10 Desktop.
I have also tried re-installation of module.
You can better navigate to your python scripts folder and open a command window there and try pip3 install quandl .Hope this helps.