Trouble importing Python modules on Ninja IDE

2024/9/20 5:58:11

I have been trying to import modules into Ninja IDE for python. These are modules that I have working on the terminal (numpy, scipy, scitools, matplotlib, and mpl_toolkits), but will not run correctly in Ninja.

First I was only getting the message No module named ____. I checked sys.path and found that the path was within the application

/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7 was a typical path. I tried changing the path,but it doesn't seem to do anything to sys.path even after restarting the ide.

But I wanted the path to refer to where the modules are stored (which is /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages). I was able to get numpy and scipy to work as well as parts of mpl_toolkits by adding the contents of my path to the folders that sys.path gave. However, I still can't get fully functioning modules within the ninja ide interpreter. I'll give some examples below of what happens when I import certain modules.

import matplotlib.pyplot
Traceback (most recent call last):File "<console>", line 1, in <module>File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/matplotlib/__init__.py", line 106, in <module>
ImportError: No module named sysconfigimport mpl_toolkitsfrom mpl_toolkits.mplot3d import axes3d
Traceback (most recent call last):File "<console>", line 1, in <module>File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/mpl_toolkits/mplot3d/__init__.py", line 1, in <module>File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/mpl_toolkits/mplot3d/axes3d.py", line 14, in <module>File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/matplotlib/__init__.py", line 106, in <module>
ImportError: No module named sysconfig

Thanks for the help. I apologize, I am very new to programming, but I did put in about a day and a half of research before posting here.

Answer

That's strange as the sysconfig module is a part of Python 2.7 standard library. Are you sure that Ninja is using the right Python version? Try running:

import sys
print sys.version_info

from Ninja, to see which Python version it is actually using.

https://en.xdnf.cn/q/72737.html

Related Q&A

UTF-8 error with Python and gettext

I use UTF-8 in my editor, so all strings displayed here are UTF-8 in file.I have a python script like this:# -*- coding: utf-8 -*- ... parser = optparse.OptionParser(description=_(automates the dice ro…

Add build information in Jenkins using REST

Does anyone know how to add build information to an existing Jenkins build? What Im trying to do is replace the #1 build number with the actual full version number that the build represents. I can do …

Combining element-wise and matrix multiplication with multi-dimensional arrays in NumPy

I have two multidimensional NumPy arrays, A and B, with A.shape = (K, d, N) and B.shape = (K, N, d). I would like to perform an element-wise operation over axis 0 (K), with that operation being matrix …

Target array shape different to expected output using Tensorflow

Im trying to make a CNN (still a beginner). When trying to fit the model I am getting this error:ValueError: A target array with shape (10000, 10) was passed for output of shape (None, 6, 6, 10) while …

Using openpyxl to refresh pivot tables in Excle

I have a file that has several tabs that have pivot tables that are based on one data tab. I am able to write the data to the data tab without issue, but I cant figure out how to get all of the tabs wi…

python: is there a library function for chunking an input stream?

I want to chunk an input stream for batch processing. Given an input list or generator,x_in = [1, 2, 3, 4, 5, 6 ...]I want a function that will return chunks of that input. Say, if chunk_size=4, then,x…

jinja2: How to make it fail Silently like djangotemplate

Well i dont find the answer Im sure that its very simple, but i just dont find out how to make it work like Django when it doesnt find a variablei tried to use Undefined and create my own undefined but…

ImportError when from transformers import BertTokenizer

My code is: import torch from transformers import BertTokenizer from IPython.display import clear_outputI got error in line from transformers import BertTokenizer: ImportError: /lib/x86_64-linux-gnu/li…

How to get feature names of shap_values from TreeExplainer?

I am doing a shap tutorial, and attempting to get the shap values for each person in a dataset from sklearn.model_selection import train_test_split import xgboost import shap import numpy as np import …

How can I clear a line in console after using \r and printing some text?

For my current project, there are some pieces of code that are slow and which I cant make faster. To get some feedback how much was done / has to be done, Ive created a progress snippet which you can s…