Repository: spyder-ide/spyder

Issue:
Opening Dataframe in Variable Explorer not working with packaged 4.2.1 dmg version of Spyder
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [ ] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [ ] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [ ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [x] Tried basic troubleshooting (if a bug/error)
    * [x] Restarted console 

- [ ] Spyder

    * [ ] Reset preferences with ``spyder --reset``
    * [ ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [ ] Tried the other applicable steps from the Troubleshooting Guide
* [ ] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description
Get an error when attempting to open a pandas Dataframe from the Variable Explorer:
![image](https://user-images.githubusercontent.com/59556820/103656656-26708200-4f69-11eb-895f-d74f61cde2a9.png)



### What steps reproduce the problem?

1. Run a script output a pandas Dataframe.
2. Open Pandas DataFrame from the variable explorer (double-clicking or right-click)
3. 

### What is the expected output? What do you see instead?
Open's new window showing the DataFrame as in previous version of Spyder


### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

PASTE TRACEBACK HERE

```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 4.2.1
* Python version: 3.9.1 64-bit
* Qt version: 5.12.1
* PyQt version: 5.12.3
* Operating System name/version: Darwin 20.2.0 (Mac OS Big Sur) 

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
PASTE DEPENDENCIES HERE
```



Discussion:

Resolving patch:
diff --git a/installers/macOS/setup.py b/installers/macOS/setup.py
--- a/installers/macOS/setup.py
+++ b/installers/macOS/setup.py
@@ -68,13 +68,6 @@ def make_app_bundle(dist_dir, make_lite=False):
         File "<frozen zipimport>", line 177, in get_data
         KeyError: 'blib2to3/Users/rclary/Library/Caches/black/20.8b1/
         Grammar3.8.6.final.0.pickle'
-    ipykernel :
-        ModuleNotFoundError: No module named 'ipykernel.datapub'
-    ipython :
-        [IPKernelApp] WARNING | Could not copy README_STARTUP to startup dir.
-        Source file
-        <path>/Resources/lib/python38.zip/IPython/core/profile/README_STARTUP
-        does not exist
     jedi :
         jedi.api.environment.InvalidPythonEnvironment: Could not get version
         information for '<path>/Contents/MacOS/python': InternalError("The
@@ -84,17 +77,18 @@ def make_app_bundle(dist_dir, make_lite=False):
         No module named 'jinja2.ext'
     keyring :
         ModuleNotFoundError: No module named 'keyring.backends.<mod>'
+    pandas :
+        From Variable explorer: KeyError('pandas._libs.interval')
     parso :
-        NotADirectoryError: [Errno 20] Not a directory:
-        '<path>/Resources/lib/python38.zip/parso/python/grammar38.txt'
+        jedi.api.environment.InvalidPythonEnvironment: Could not get version
+        information for '/Users/rclary/opt/miniconda3/envs/c2w_37/bin/python':
+        InternalError("The subprocess /Users/rclary/opt/miniconda3/envs/c2w_37/
+        bin/python has crashed (EOFError('Ran out of input'), stderr=).")
     PIL :
         Library not loaded: @loader_path/.dylibs/libjpeg.9.dylib
         Note: only applicable to not-Lite build
     pygments :
         ModuleNotFoundError: No module named 'pygments.formatters.latex'
-    pylint :
-        No module named pylint.__main__; 'pylint' is a package and cannot be
-        directly executed
     pyls :
         <path>/Contents/MacOS/python: No module named pyls
         Note: still occurs in alias mode
@@ -112,8 +106,6 @@ def make_app_bundle(dist_dir, make_lite=False):
     spyder :
         NotADirectoryError: [Errno 20] Not a directory: '<path>/Resources/lib/
         python38.zip/spyder/app/mac_stylesheet.qss'
-    spyder_kernels :
-        No module named spyder_kernels.console.__main__
     textdistance :
         NotADirectoryError: [Errno 20] Not a directory: '<path>/Resources/lib/
         python39.zip/textdistance/libraries.json'
@@ -128,23 +120,28 @@ def make_app_bundle(dist_dir, make_lite=False):
     build_type = 'lite' if make_lite else 'full'
     logger.info('Creating %s app bundle...', build_type)
 
-    PACKAGES = ['alabaster', 'astroid', 'blib2to3', 'ipykernel', 'IPython',
-                'jedi', 'jinja2', 'keyring', 'parso', 'pygments', 'pylint',
-                'pyls', 'pyls_black', 'pyls_spyder', 'qtawesome', 'setuptools',
-                'sphinx', 'spyder', 'spyder_kernels', 'textdistance']
+    PACKAGES = ['alabaster', 'astroid', 'blib2to3', 'jedi', 'jinja2',
+                'keyring', 'parso', 'pygments', 'pyls', 'pyls_black',
+                'pyls_spyder', 'qtawesome', 'setuptools', 'sphinx', 'spyder',
+                'textdistance',
+                ]
+
+    EXCLUDE_EGG = ['py2app']
 
     if make_lite:
         INCLUDES = []
         EXCLUDES = [
-            'numpy', 'scipy', 'pandas', 'matplotlib', 'cython', 'sympy'
+            'numpy', 'scipy', 'pandas', 'matplotlib', 'cython', 'sympy', 'PIL'
         ]
+        EXCLUDE_EGG.append('pillow')
     else:
         INCLUDES = [
             'numpy', 'scipy', 'pandas', 'matplotlib', 'cython', 'sympy'
         ]
         EXCLUDES = []
-        PACKAGES.append('PIL')
+        PACKAGES.extend(['pandas', 'PIL'])
 
+    EXCLUDE_EGG.extend(EXCLUDES)
     EDIT_EXT = [ext[1:] for ext in _get_extensions(EDIT_FILETYPES)]
 
     FRAMEWORKS = ['/usr/local/lib/libspatialindex.dylib',
@@ -179,11 +176,13 @@ def make_app_bundle(dist_dir, make_lite=False):
         os.remove(app_script_path)
         os.remove(SPYLINK)
 
-    # Copy egg info from site-packages: fixes pkg_resources issue for pyls
+    # Copy egg info from site-packages: fixes several pkg_resources issues
     dest_dir = os.path.join(dist_dir, MAC_APP_NAME, 'Contents', 'Resources',
                             'lib', f'python{PYVER[0]}.{PYVER[1]}')
     for dist in pkg_resources.working_set:
-        if dist.egg_info is None:
+        if (dist.egg_info is None or dist.key.startswith('pyobjc')
+                or dist.key in EXCLUDE_EGG):
+            logger.info(f'Skipping egg {dist.key}')
             continue
         egg = os.path.basename(dist.egg_info)
         dest = os.path.join(dest_dir, egg)


Test patch: