import error for ibm_db using PyInstaller - db2

How I can fix the bellow error?
I have a python code using GUI (tkinter) to get value and use the value to get data from ibm DB.
however, when I wanted to change it from py to exe using pyinstaller I get the bellow message:
my imports are:
import tkinter as tk
from tkinter import filedialog
import pandas as pd
import ibm_db
import ibm_db_dbi
import pandastable
from Calendar import Calendar
import numpy as np
import matplotlib.pyplot as plt
import calendar
import datetime
import sys
the code I am using
pyinstaller -F -w myfile.py
thanks $

Related

ImportError: cannot import name 'compute_associations' from 'dython.nominal'

I just installed dython using pip install dython to use the tabsyndex. Here is the block of import
import pandas as pd
from tabsyndex import tabsyndex
from sklearn.model_selection import train_test_split
and it always shows
ImportError: cannot import name 'compute_associations' from 'dython.nominal'
Are there any way to import compute associations?
So far I tried reinstalling dython, but it always show the same error.

import name 'Mapping' from 'collections'

I have installed yfinance, but when i try to import it, it gives me the error: cannot import name 'Mapping' from 'collections'. I tried writing on jupyter notebook from collections.abs import Mappings, but it didn't work. I tried to look at the file init.py, but there is no: from collection import mapping, there is only import _collections_abc, and from _collections import deque.
Please help if someone has a solution?My python version is 3.10.5

Unable to resolve the ImportError: cannot import name 'spline' from 'scipy.interpolate'

Tried to import the following libraries in python.
import quantsbin.derivativepricing as qbdp
import scipy.interpolate.interpnd
from scipy.interpolate import interp1d
from scipy.interpolate import spline
Got the following error:
ImportError: cannot import name 'spline' from 'scipy.interpolate'
This function was deprecated in scipy 0.19.0 and removed in scipy 1.3.0.
So either downgrade your scipy to 1.2.3, or use the recommended replacement make_interp_spline /BSpline

Importing keras-rl package into conda environment

I've installed keras-rl package on my computer, using their instructions:
git clone https://github.com/matthiasplappert/keras-rl.git
cd keras-rl
python setup.py install
So my conda environment sees this package, however when I am trying to import it in Spyder as a part of my code, i.e. import keras-rl, I get the following error:
SyntaxError: invalid syntax
with a pointer to the dash of keras-rl.
Question: How could I import the keras-rl (or any other package with the dash in the name) in Spyder?
We can install keras-rl by simply executing
pip install keras-rl
There are various functionalities from keras-rl that we can make use for running RL based algorithms in a specified environment
few examples below
from rl.agents.dqn import DQNAgent
from rl.policy import BoltzmannQPolicy
from rl.memory import SequentialMemory
This is how we can use the package.
If you look at the examples present in the github repository, you will see that the various functionalities are imported from rl. Like this:
(root) ~/condaexpts/keras-rl/examples $ grep -h import * | grep rl
from rl.agents import ContinuousDQNAgent
from rl.memory import SequentialMemory
from rl.random import OrnsteinUhlenbeckProcess
from rl.core import Processor
from rl.agents.cem import CEMAgent
from rl.memory import EpisodeParameterMemory
from rl.agents import DDPGAgent
from rl.memory import SequentialMemory
from rl.random import OrnsteinUhlenbeckProcess
from rl.agents.dqn import DQNAgent
from rl.policy import LinearAnnealedPolicy, BoltzmannQPolicy, EpsGreedyQPolicy
from rl.memory import SequentialMemory
from rl.core import Processor
from rl.callbacks import FileLogger, ModelIntervalCheckpoint
from rl.agents.dqn import DQNAgent
from rl.policy import BoltzmannQPolicy
from rl.memory import SequentialMemory
I had the same problem. After lots of examination I found the correct way.
You can import RL by writing this:
"import rl"
and then write your code like:
rl.core.Agent()

Eclipse "organize imports" changes the order of existing imports

Using Eclipse Juno (3.8/4.2), when I press ⇧⌘O (shift+ctrl+o), it organizes imports according to the Organize Imports preferences; fine.
Now imagine I'm working on some source code I checked out from SVN, and I add some code depending on new classes, I'd like Eclipse to add the new imports, WITHOUT messing with the existing order of imports (for commit's clarity sake)
for example :
package toto;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.sun.jersey.api.client.AsyncWebResource;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.json.JSONConfiguration;
will be organized in :
package toto;
import com.sun.jersey.api.client.AsyncWebResource;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.json.JSONConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
according to my preferences.
I want to avoid that, I just want to add the imports necessary for the new code I added (I don't want to organize already existing imports), is there something else than Organize Imports to do that ? (I know I can click on the error hint on the left of my new code needing a new import to add it, but I'd like a keyboard shortcut instead)
thanks for your help!
Use CtrlShiftM on an error marker to fix a missing import, repeat by jumping to the next error with Ctrl.. There is no other possibility to fix all imports in one go than organizing them (which you don't want).
This is not a single keyboard shortcut, but you can do what you describe in a series of steps using the keyboard only:
Press Ctrl+. to go to the next error in the code
Press Ctrl+1 to display the quick fixes
Press Enter to add the import.