TypeError: an integer is required (got type bytes)
See original GitHub issueSince upgrading to python 3.8 I can’t access my old jobs’ submission pickle (error below).
The problem might be related to this issue or this one but I have no clue what it means.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-17-0248393e65dd> in <module>
30 if state != "COMPLETED":
31 continue
---> 32 row = job.submission().kwargs
33 row["scores"] = job.result()
34 row["exp_name"] = exp_name
~/dev/ext/submitit/submitit/core/core.py in submission(self)
206 self.paths.submitted_pickle.exists()
207 ), f"Cannot find job submission pickle: {self.paths.submitted_pickle}"
--> 208 return utils.DelayedSubmission.load(self.paths.submitted_pickle)
209
210 def cancel_at_deletion(self, value: bool = True) -> "Job[R]":
~/dev/ext/submitit/submitit/core/utils.py in load(cls, filepath)
133 @classmethod
134 def load(cls: Type["DelayedSubmission"], filepath: Union[str, Path]) -> "DelayedSubmission":
--> 135 obj = pickle_load(filepath)
136 # following assertion is relaxed compared to isinstance, to allow flexibility
137 # (Eg: copying this class in a project to be able to have checkpointable jobs without adding submitit as dependency)
~/dev/ext/submitit/submitit/core/utils.py in pickle_load(filename)
271 # this is used by cloudpickle as well
272 with open(filename, "rb") as ifile:
--> 273 return pickle.load(ifile)
274
275
TypeError: an integer is required (got type bytes)
Repro: Start a job with python 3.7 and then try to access it in python 3.8. In python 3.7
Python 3.7.4 (default, Aug 13 2019, 20:35:49)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import submitit
>>>
>>> def add(a, b):
... return a + b
...
>>> executor = submitit.AutoExecutor(folder="log_test")
>>> executor.update_parameters(timeout_min=1, slurm_partition="dev")
>>> job = executor.submit(add, 5, 7)
>>> print(job.job_id)
33389760
>>> job.submission()
<submitit.core.utils.DelayedSubmission object at 0x7f42f5952bd0>
In python 3.8
Python 3.8.5 | packaged by conda-forge | (default, Jul 24 2020, 01:25:15)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import submitit
>>> job = submitit.SlurmJob("log_test", "33389760")
>>> job.submission()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/private/home/louismartin/dev/ext/submitit/submitit/core/core.py", line 208, in submission
return utils.DelayedSubmission.load(self.paths.submitted_pickle)
File "/private/home/louismartin/dev/ext/submitit/submitit/core/utils.py", line 135, in load
obj = pickle_load(filepath)
File "/private/home/louismartin/dev/ext/submitit/submitit/core/utils.py", line 273, in pickle_load
return pickle.load(ifile)
TypeError: an integer is required (got type bytes)
>>> job.submission()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/private/home/louismartin/dev/ext/submitit/submitit/core/core.py", line 208, in submission
return utils.DelayedSubmission.load(self.paths.submitted_pickle)
File "/private/home/louismartin/dev/ext/submitit/submitit/core/utils.py", line 135, in load
obj = pickle_load(filepath)
File "/private/home/louismartin/dev/ext/submitit/submitit/core/utils.py", line 273, in pickle_load
return pickle.load(ifile)
TypeError: an integer is required (got type bytes)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How to fix 'TypeError: an integer is required (got type bytes ...
I've installed OpenJDK 13.0.1 and python 3.8 and spark 2.4.4. Instructions to test the install is to run .\bin\pyspark from the root of...
Read more >Fix - TypeError: an integer is required (got type bytes) - Kontext
When running PySpark 2.4.8 script in Python 3.8 environment with Anaconda, the following issue occurs: TypeError: an integer is required (got ...
Read more >TypeError: an integer is required (got type bytes) #404 - GitHub
Since upgrading to python 3.8 I can't access pickle files created with python 3.7. This originated from this issue and might be related...
Read more >an integer is required (got type bytes) on python 3.8.5 ... - Reddit
I need help! Pyspark TypeError: an integer is required (got type bytes) on python 3.8.5, how to fix this on Ubuntu?
Read more >return types.CodeType( TypeError: an integer is required (got ...
Hi Friends,. I'm getting the below error when just executing import pyspark in IDE. I have already set the Project structure as :....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually this seems to be a bug with cloudpickle, simpler repro:
In python 3.7 (cloudpickle==1.6.0):
In python 3.8 (cloudpickle==1.6.0):
Throws
I’ll create an issue in cloudpickle.
Works for me. I’ll need more details to help you.
I ran the above script with two versions of python, 3.8 and 3.6. Both environment had submitit installed. Submitit isn’t required but I wanted to pickle a non trivial object instead of just a string.