Python Forum
Problem running script within console
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem running script within console
#1
Hi there,

I'm using Anaconda 3.x and Spyder 4.1.1.

I'm trying to interpreted the script
import numpy
.

This works while executed by Spyder. But
python myPiy.py
fails with the error
Error:
C:\Users\myuser\Anaconda3\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service from . import _distributor_init Traceback (most recent call last): File "C:\Users\myuser\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 24, in <module> from . import multiarray File "C:\Users\myuser\Anaconda3\lib\site-packages\numpy\core\multiarray.py", line 14, in <module> from . import overrides File "C:\Users\myuser\Anaconda3\lib\site-packages\numpy\core\overrides.py", line 7, in <module> from numpy.core._multiarray_umath import ( ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "myPiy..py", line 3, in <module> import numpy File "C:\Users\myuser\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module> from . import core File "C:\Users\myuser\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 54, in <module> raise ImportError(msg) ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy c-extensions failed. - Try uninstalling and reinstalling numpy. - If you have already done that, then: 1. Check that you expected to use Python3.7 from "C:\Users\myuser\Anaconda3\python.exe", and that you have no directories in your PATH or PYTHONPATH that can interfere with the Python and numpy version "1.18.1" 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 - If you're working with a numpy git repository, try `git clean -xdf` (removes all files not under version control) and rebuild numpy.
I tried to reinstall numpy, which I installed manually using conda install numpy to begin with.

Using instead modules, which came with Anaconda, e. g.
[apython]import time[\python],
everything works fine.

How can I make additional installed modules known to the Python interpreter?

Thanks in advance for your reply,

Johannes
Reply
#2
I had a similar problem and eventually determined I installed the package on python 3.8 but running a script as you are doing ran python 3.6. Another time I installed a package inside a virtual environment and couldn't see it when I ran my global environment. So easy to get that messed up.
Reply
#3
(Mar-25-2020, 03:42 AM)deanhystad Wrote: I had a similar problem and eventually determined I installed the package on python 3.8 but running a script as you are doing ran python 3.6. Another time I installed a package inside a virtual environment and couldn't see it when I ran my global environment. So easy to get that messed up.

Thanks’ a lot, choosing the correct environment actually is related to my problem. I don’t understand what I’m doing but I was able to solve a part of my problem by playing with the existing environments. Still my core issue remains. Could you please answer another question concerning this?
  • How do I set with python.exe the used environment before running a script?
  • How to choose the environment “conda install foo” installs a module in?

Thanks in advance,
Regards,

Johannes
Reply
#4
(Mar-25-2020, 06:44 PM)koepjo Wrote:
(Mar-25-2020, 03:42 AM)deanhystad Wrote: I had a similar problem and eventually determined I installed the package on python 3.8 but running a script as you are doing ran python 3.6. Another time I installed a package inside a virtual environment and couldn't see it when I ran my global environment. So easy to get that messed up.

Thanks’ a lot, choosing the correct environment actually is related to my problem. I don’t understand what I’m doing but I was able to solve a part of my problem by playing with the existing environments. Still my core issue remains. Could you please answer another question concerning this?
  • How do I set with python.exe the used environment before running a script?
  • How to choose the environment “conda install foo” installs a module in?

Thanks in advance,
Regards,

Johannes

I was able to change the envionment by running
activate.bat
in the environment's "Script" folder. Afterward I can execute my wcript with
python.exe myScrript
. Then the required modules are available, thank's again for the hint!

But doing this in a bat script doesn't work. It's execution stops without any output after the activate script finished. What can I do?

Thank's a lot in advance!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  No Internet connection when running a Python script basil_555 8 566 Mar-11-2024, 11:02 AM
Last Post: snippsat
Question Running Python script through Task Scheduler? Winfried 8 454 Mar-10-2024, 07:24 PM
Last Post: Winfried
  Combine console script + GUI (tkinter) dejot 2 407 Feb-27-2024, 04:38 PM
Last Post: deanhystad
  problem in running a code akbarza 7 603 Feb-14-2024, 02:57 PM
Last Post: snippsat
  Help Running Python Script in Mac OS emojistickers 0 331 Nov-20-2023, 01:58 PM
Last Post: emojistickers
  Trying to make a board with turtle, nothing happens when running script Quascia 3 652 Nov-01-2023, 03:11 PM
Last Post: deanhystad
  Python script running under windows over nssm.exe JaroslavZ 0 699 May-12-2023, 09:22 AM
Last Post: JaroslavZ
  Running script with subprocess in another directory paul18fr 1 3,657 Jan-20-2023, 02:33 PM
Last Post: paul18fr
  Make console show after script was built with Pyinstaller --NOCONSOLE? H84Gabor 0 1,206 May-05-2022, 12:32 PM
Last Post: H84Gabor
  Script stop work after 3 actioins - PLEASE WHERE IS THE PROBLEM? rondon442 0 1,554 Sep-27-2021, 05:40 PM
Last Post: rondon442

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020