-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete unused and deprecated import #48
Conversation
I'm encountering this issue as well. @mattloper , are you able to review and merge this and release an update? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not an official maintainer so I can't do the merge or release, but I looked through the code and confirm that nothing in this import line is used, but due to deprecations in numpy 1.24 it is causing the program to break.
@AndresCasado For your info and anyone else that comes across this, I created a Dockerfile that builds a minimal environment with Python2.7 and the required libraries to execute this action. The Dockerfile:
I call it with a bash script like:
And finally, I copied their from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import argparse
import glob
import os
import os.path as osp
import pickle
import numpy as np
def clean_fn(fn, output_folder='output'):
with open(fn, 'rb') as body_file:
body_data = pickle.load(body_file)
output_dict = {}
for key, data in body_data.iteritems():
if 'chumpy' in str(type(data)):
output_dict[key] = np.array(data)
else:
output_dict[key] = data
out_fn = osp.split(fn)[1]
out_path = osp.join(output_folder, out_fn)
with open(out_path, 'wb') as out_file:
pickle.dump(output_dict, out_file, protocol=2)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--input-folder',
dest='input_folder',
required=False,
type=str,
default="input_folder",
help='The path to the folder containing the models to be processed',
)
parser.add_argument(
'--output-folder',
dest='output_folder',
required=False,
type=str,
default="output_folder",
help='The path to the output folder',
)
args = parser.parse_args()
input_folder = args.input_folder
output_folder = args.output_folder
if not osp.exists(output_folder):
print('Creating directory: {}'.format(output_folder))
os.makedirs(output_folder)
# Get a list of .pkl files in the input folder
input_models = glob.glob(os.path.join(input_folder, '*.pkl'))
for input_model in input_models:
clean_fn(input_model, output_folder=output_folder) If you stick all of this in a directory and update the paths for your setup, you should be good. Hope this helps! |
@BotScutters Hi, yes, that's how I ended up finding the problem. I'll try to clean the files with that, thank you! |
This makes Chumpy work with latest numpy version