Carnets icon indicating copy to clipboard operation
Carnets copied to clipboard

ios excel file issue

Open rickybass opened this issue 4 years ago • 11 comments

I am relatively new to Github so I apologize if this is not the appropriate place to post this. I tried Carnets on my iPad pro. Even though I have an excel file and the Jupyter notebook in the same folder Carnets cannot find it. Any thoughts how to troubleshoot?

rickybass avatar May 12 '20 17:05 rickybass

Hi, Thanks for reaching. I'm going to assume the two files are not in the Carnets application folder, but in the folder of a different application.

If that is indeed the case, the explanation is simple: iOS has very restrictive file access permissions. An application can only access files in its own directory, and files for which it received explicit permission. When you clicked on the notebook to open it, you explicitly granted Carnets permission to open the notebook. But that permission does not extend to other files, even if they are in the same directory.

The solution is simple: you need to also grant Carnets permission to access the entire directory. There is a button for this in the user interface, the one that looks like a folder (circled in red in the first image).

twitter_ERU5fuBWoAE7_nk

Once you click it, you see a menu where you can select a folder. Navigate to the folder enclosing the notebook and the excel file, and click "Done".

twitter_ERU584TXsAEW24K

Once this is done, your notebook has access to the entire directory, and thus to the excel file.

If my original assumption was wrong, let's keep talking.

holzschu avatar May 12 '20 19:05 holzschu

I think I did the way you instructed.itried both in the Carnets folder on my iPad as well as carnets folder in iCloud

Thanks

Thanks

Ricky Bass

Pat F. Bass III, MD, MS, MPH Professor of Medicine and Pediatrics LSU Health Shreveport P: 318-675-6490 C: 318-573-9413 F: 318-675-8150

On May 12, 2020, at 2:35 PM, Nicolas Holzschuch [email protected] wrote:

EXTERNAL EMAIL: EVALUATE

Hi, Thanks for reaching. I'm going to assume the two files are not in the Carnets application folder, but in the folder of a different application.

If that is indeed the case, the explanation is simple: iOS has very restrictive file access permissions. An application can only access files in its own directory, and files for which it received explicit permission. When you clicked on the notebook to open it, you explicitly granted Carnets permission to open the notebook. But that permission does not extend to other files, even if they are in the same directory.

The solution is simple: you need to also grant Carnets permission to access the entire directory. There is a button for this in the user interface, the one that looks like a folder (circled in red in the first image).

https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F8070736%2F81737219-0f3fca00-9498-11ea-8595-31135a0595dc.jpg&data=02%7C01%7Cpbassi%40lsuhsc.edu%7Cfea3f1e43b1944dcb47608d7f6ab9282%7C3406368982d44e89a3281ab79cc58d9d%7C0%7C0%7C637249089092988892&sdata=TuLb9KDWPU7LPJz0p5zSETJiw9Vi1HZT36M7kMCzmJU%3D&reserved=0 Once you click it, you see a menu where you can select a folder. Navigate to the folder enclosing the notebook and the excel file, and click "Done".

https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F8070736%2F81737282-2da5c580-9498-11ea-92eb-3bfa03f3df0c.jpg&data=02%7C01%7Cpbassi%40lsuhsc.edu%7Cfea3f1e43b1944dcb47608d7f6ab9282%7C3406368982d44e89a3281ab79cc58d9d%7C0%7C0%7C637249089092998887&sdata=0%2B1ICpfVTo3Gyql0KAO6EPf1naQRJWc%2FknegFMtM0S8%3D&reserved=0 Once this is done, your notebook has access to the entire directory, and thus to the excel file.

If my original assumption was wrong, let's keep talking.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fholzschu%2FCarnets%2Fissues%2F101%23issuecomment-627548916&data=02%7C01%7Cpbassi%40lsuhsc.edu%7Cfea3f1e43b1944dcb47608d7f6ab9282%7C3406368982d44e89a3281ab79cc58d9d%7C0%7C0%7C637249089093008886&sdata=hTRynZMYNhW86WOcVSsae1Rd68VXTsNFLNMWcRhDGSg%3D&reserved=0, or unsubscribe https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGB2TI63QS3JHBIXX3SNUVLRRGQGRANCNFSM4M7BGODA&data=02%7C01%7Cpbassi%40lsuhsc.edu%7Cfea3f1e43b1944dcb47608d7f6ab9282%7C3406368982d44e89a3281ab79cc58d9d%7C0%7C0%7C637249089093008886&sdata=1rADD%2F7j3fln5jEe%2F7CuoC5U0RLlriRcXE47LoXaXxM%3D&reserved=0.

rickybass avatar May 15 '20 17:05 rickybass

It seems that to load Excel files, you need to add the "xlrd" package. "!pip install xlrd" should do the trick. Let me know if it works.

holzschu avatar May 15 '20 18:05 holzschu

I am getting the same error

Thanks

Ricky Bass

Pat F. Bass III, MD, MS, MPH Professor of Medicine and Pediatrics LSU Health Shreveport P: 318-675-6490 C: 318-573-9413 F: 318-675-8150

On May 15, 2020, at 1:36 PM, Nicolas Holzschuch [email protected] wrote:

EXTERNAL EMAIL: EVALUATE

It seems that to load Excel files, you need to add the "xlrd" package. "!pip install xlrd" should do the trick. Let me know if it works.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fholzschu%2FCarnets%2Fissues%2F101%23issuecomment-629415253&data=02%7C01%7Cpbassi%40lsuhsc.edu%7C47d50babad24490bc1f108d7f8fee9ce%7C3406368982d44e89a3281ab79cc58d9d%7C0%7C0%7C637251646040621220&sdata=ZzKWi3DXXYW%2FlkkBfbF6Ltj2l28WgZAX3XV1QQTqf54%3D&reserved=0, or unsubscribe https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGB2TI4OMFFHP7M2SIRFQPDRRWDTVANCNFSM4M7BGODA&data=02%7C01%7Cpbassi%40lsuhsc.edu%7C47d50babad24490bc1f108d7f8fee9ce%7C3406368982d44e89a3281ab79cc58d9d%7C0%7C0%7C637251646040631217&sdata=TL2HRpMcPyh71VpGXbEsmiyoXEkAtO8WAk8UTgSJ9VE%3D&reserved=0.

rickybass avatar May 15 '20 22:05 rickybass

Can you attach the notebook and Excel file here so I can have a look?

holzschu avatar May 16 '20 06:05 holzschu

I was able to covert it to an excel spreadsheet and get it to work as you can see.

rickybass avatar May 17 '20 13:05 rickybass

Hi @holzschu - I’m having the same issue. I uploaded the notebook and excel file here - https://drive.google.com/drive/u/2/folders/1N3wd06Wc-PHl1m8lR_qcEqIC8g9-1ddb

Command: pd.read_excel('Excel_Sample.xlsx',sheet_name='Sheet1')

Error `

ImportError Traceback (most recent call last) in ----> 1 pd.read_excel('Excel_Sample.xlsx',sheet_name='Sheet1')

/private/var/containers/Bundle/Application/C19071B6-07E4-4187-8A3B-17EBC68D658A/Carnets.app/Library/lib/python3.9/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs) 297 ) 298 warnings.warn(msg, FutureWarning, stacklevel=stacklevel) --> 299 return func(*args, **kwargs) 300 301 return wrapper

/private/var/containers/Bundle/Application/C19071B6-07E4-4187-8A3B-17EBC68D658A/Carnets.app/Library/lib/python3.9/site-packages/pandas/io/excel/_base.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, thousands, comment, skipfooter, convert_float, mangle_dupe_cols, storage_options) 334 if not isinstance(io, ExcelFile): 335 should_close = True --> 336 io = ExcelFile(io, storage_options=storage_options, engine=engine) 337 elif engine and engine != io.engine: 338 raise ValueError(

/private/var/containers/Bundle/Application/C19071B6-07E4-4187-8A3B-17EBC68D658A/Carnets.app/Library/lib/python3.9/site-packages/pandas/io/excel/_base.py in init(self, path_or_buffer, engine, storage_options) 1129 self.storage_options = storage_options 1130 -> 1131 self._reader = self._engines[engine](self._io, storage_options=storage_options) 1132 1133 def fspath(self):

/private/var/containers/Bundle/Application/C19071B6-07E4-4187-8A3B-17EBC68D658A/Carnets.app/Library/lib/python3.9/site-packages/pandas/io/excel/_xlrd.py in init(self, filepath_or_buffer, storage_options) 22 """ 23 err_msg = "Install xlrd >= 1.0.0 for Excel support" ---> 24 import_optional_dependency("xlrd", extra=err_msg) 25 super().init(filepath_or_buffer, storage_options=storage_options) 26

/private/var/containers/Bundle/Application/C19071B6-07E4-4187-8A3B-17EBC68D658A/Carnets.app/Library/lib/python3.9/site-packages/pandas/compat/_optional.py in import_optional_dependency(name, extra, raise_on_missing, on_version) 107 except ImportError: 108 if raise_on_missing: --> 109 raise ImportError(msg) from None 110 else: 111 return None

ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd. Excel_Sample.xlsx `

yanivnizan avatar Aug 11 '21 07:08 yanivnizan

Please try "!pip install xlrd" to install the xlrd package, then retry loading the Excel file.

holzschu avatar Aug 11 '21 07:08 holzschu

Hi, I’m getting the message below when I run “!pip install xlrd”

The excel file still doesn’t open and would give me this error instead: ValueError: Your version of xlrd is 2.0.1. In xlrd >= 2.0, only the xls format is supported. Install openpyxl instead.

Message: `Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: xlrd in /private/var/mobile/Containers/Data/Application/30586C38-FE0F-466B-88FD-2A2173F5CDF3/Library/lib/python3.9/site-packages (2.0.1)

WARNING: You are using pip version 21.1.1; however, version 21.2.3 is available. You should consider upgrading via the '/private/var/containers/Bundle/Application/C19071B6-07E4-4187-8A3B-17EBC68D658A/Carnets.app/Library/bin/python3 -m pip install --upgrade pip' command.

Note: you may need to restart the kernel to use updated packages.`

yanivnizan avatar Aug 11 '21 07:08 yanivnizan

ok, so this worked for me: !pip install openpyxl

yanivnizan avatar Aug 11 '21 07:08 yanivnizan

@holzschu thanks man - great app!

yanivnizan avatar Aug 11 '21 07:08 yanivnizan